{
  "info": {
    "title": "Personal AI Coach — API contract review",
    "version": "0.0.0",
    "description": "Review the proposed API inputs, outputs and errors before service implementation.\n\n52 procedures are contract-only; 3 procedures are marked implemented.\n\nThis OpenAPI document projects the logical contracts into HTTP operations for review. The running application uses oRPC RPC; these are not published REST endpoints. Request execution is disabled.\n\nDisplayed JSON samples are generated from schemas; they are illustrations, not actual service responses or accepted business scenarios.\n\nResult logs, habit logs and action logs each have a dedicated API group and model. Their wire collections use result_logs, habit_logs and action_logs. User billing fields derive from subscription and connected derives from oauth_consent.\n\nRequired, optional and nullable fields are generated from the canonical schemas. Cross-field checks and rules requiring stored state remain runtime/service obligations; read operation notes and the feature acceptance criteria.\n\n## API and UI language\n\nWire names follow the current domain schema. Screen labels describe the same records from the user’s perspective; they do not introduce additional entities or enum values.\n\n| API concept | Prototype UI label |\n| --- | --- |\n| Result logs | Updates; non-empty log comments also appear under Comments |\n| Habit logs | Marked calendar days; Updates table with a Marked column |\n| Action logs | Comments shows only logs with comments; status history remains in the API |\n| Action status: open / in_progress / done | Open / In progress / Done; To do groups the first two |\n| Cycle start_at / end_at; objective deadline_at; action due_at | Starts / Ends; Deadline; Due |\n| Result metric_type; start_value / target_value; per | Type; Start / Target (Goal on chart); Times per Cadence |\n| Session vendor: openai / claude | ChatGPT / Claude |\n| Session briefing_notes / summary_notes / source_url | Briefing / Summary / Open the conversation |\n| Session ended_at | In progress when null; Closed when set |\n| Subscription past_due / incomplete | Payment failed / Awaiting payment |\n| Subscription active with cancel_at_period_end | Cancels <date> with Access until; Cancellation scheduled when no period end is known |\n| User name | Name; signup asks “What should we call you?” |\n| Billing details plan / payment_method (null) | Plan and Price / Payment method (No subscription / No payment method) |\n\n## Prototype alignment\n\nReconciled on 2 Oct 2026 (CB-049 Reconcile API and prototype language differences); the prototype was revised in its design source and these now agree:\n\n- **Profile name:** Settings has one Name field and signup asks “What should we call you?”, matching the single chosen `name`.\n\n- **Entity wording:** prototype authoring notes and fixture identifiers say ResultLog and HabitLog; visible Updates and Marked remain UI copy.\n\n- **Payment failure:** paid access is active-only; past-due, canceled and incomplete keep reads and block coaching writes and session starts, with no grace-period promise.\n\n- **Objective deadline:** an update accepts an omitted field or a date; null is rejected on API and MCP alike. Creation without a deadline stays valid and the returned value stays nullable.\n\n- **Billing details:** Settings reads Plan, Price and Payment method from `billing.get_details`, which loads independently and fails with a retryable error without blocking local status.\n\n- **Scheduled cancellation:** the prototype derives it from active status, cancel-at-period-end and the period end; there is no fifth status.\n\n- **Profile edits while lapsed:** `user.update` is an account action, available on the web without an active plan; the chat tool `user_update` still requires one.\n\n- **Resubscribe:** a canceled plan restarts through `billing.create_checkout_session`; the billing portal manages an existing subscription and cannot start one.\n\n**Not in the POC:** changing the login email. It is read-only everywhere; no record is keyed by email, so it can be added later without a data migration."
  },
  "servers": [
    {
      "url": "https://contract-review.invalid",
      "description": "Design reference — no live REST server"
    }
  ],
  "tags": [
    {
      "name": "User"
    },
    {
      "name": "Billing"
    },
    {
      "name": "Cycles"
    },
    {
      "name": "Objectives"
    },
    {
      "name": "Results"
    },
    {
      "name": "Result logs"
    },
    {
      "name": "Habit logs"
    },
    {
      "name": "Actions"
    },
    {
      "name": "Action logs"
    },
    {
      "name": "Notes"
    },
    {
      "name": "Sessions"
    },
    {
      "name": "Record"
    },
    {
      "name": "Example"
    }
  ],
  "openapi": "3.1.1",
  "components": {
    "schemas": {
      "Cycle": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "intention": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "UI label: Intention. Optional guiding focus; the cycle is identified by its date range, not a name."
          },
          "start_at": {
            "type": "string",
            "format": "date",
            "description": "UI label: Starts."
          },
          "end_at": {
            "type": "string",
            "format": "date",
            "description": "UI label: Ends."
          },
          "status": {
            "enum": [
              "active",
              "archived"
            ],
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "achievement_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "UI label: Achievement. Derived from objective progress; unavailable when nothing is measurable."
          },
          "time_gone_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "UI label: Time gone. Derived percentage of the cycle elapsed."
          },
          "length_weeks": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "UI label: Length, in weeks; derived from Starts and Ends."
          }
        },
        "required": [
          "id",
          "intention",
          "start_at",
          "end_at",
          "status",
          "created_at",
          "url",
          "achievement_pct",
          "time_gone_pct",
          "length_weeks"
        ],
        "additionalProperties": false
      },
      "Objective": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "cycle_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "deadline_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "description": "Calendar date as YYYY-MM-DD in the profile timezone."
              },
              {
                "type": "null"
              }
            ],
            "description": "UI label: Deadline; null when no deadline has been set."
          },
          "status": {
            "enum": [
              "on_track",
              "off_track",
              "completed"
            ],
            "type": "string",
            "description": "Objective status: On track, Off track or Completed. Coaching judgment, independent of the derived Progress percentage."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "short_code": {
            "type": "string",
            "minLength": 1
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "progress_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "UI label: Progress. Derived from measurable results, independently of Status."
          },
          "boundary_progress_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Historical progress at the resolved last-session boundary; not current Progress."
          },
          "movement_pp": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "cycle_id",
          "title",
          "description",
          "deadline_at",
          "status",
          "created_at",
          "short_code",
          "url",
          "progress_pct",
          "boundary_progress_pct",
          "movement_pp"
        ],
        "additionalProperties": false
      },
      "Result": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "objective_id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "title": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "metric_type": {
                "const": "number"
              },
              "start_value": {
                "type": "number"
              },
              "target_value": {
                "type": "number"
              },
              "unit": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "UI label: Unit. Used by Number and Performance results."
              },
              "cadence": {
                "type": "null"
              },
              "per": {
                "type": "null"
              },
              "since": {
                "type": "null"
              },
              "status": {
                "enum": [
                  "in_progress",
                  "completed"
                ],
                "type": "string",
                "description": "Result status: In progress or Completed. Reaching the target does not automatically mark the result completed."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "short_code": {
                "type": "string",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "current_value": {
                "type": "number",
                "description": "Current value displayed in the result headline; derived according to metric type from its baseline and retained evidence."
              },
              "boundary_value": {
                "type": "number"
              },
              "progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "boundary_progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement_pp": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "evidence_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "last_recorded_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_expected_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_logs_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "performance_share": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "objective_id",
              "title",
              "description",
              "metric_type",
              "start_value",
              "target_value",
              "unit",
              "cadence",
              "per",
              "since",
              "status",
              "created_at",
              "short_code",
              "url",
              "current_value",
              "boundary_value",
              "progress_pct",
              "boundary_progress_pct",
              "movement",
              "movement_pp",
              "evidence_count",
              "last_recorded_at",
              "habit_expected_since_boundary",
              "habit_logs_since_boundary",
              "performance_share"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "objective_id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "title": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "metric_type": {
                "const": "percentage"
              },
              "start_value": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "target_value": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "unit": {
                "type": "null"
              },
              "cadence": {
                "type": "null"
              },
              "per": {
                "type": "null"
              },
              "since": {
                "type": "null"
              },
              "status": {
                "enum": [
                  "in_progress",
                  "completed"
                ],
                "type": "string",
                "description": "Result status: In progress or Completed. Reaching the target does not automatically mark the result completed."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "short_code": {
                "type": "string",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "current_value": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "boundary_value": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "boundary_progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement_pp": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "evidence_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "last_recorded_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_expected_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_logs_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "performance_share": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "objective_id",
              "title",
              "description",
              "metric_type",
              "start_value",
              "target_value",
              "unit",
              "cadence",
              "per",
              "since",
              "status",
              "created_at",
              "short_code",
              "url",
              "current_value",
              "boundary_value",
              "progress_pct",
              "boundary_progress_pct",
              "movement",
              "movement_pp",
              "evidence_count",
              "last_recorded_at",
              "habit_expected_since_boundary",
              "habit_logs_since_boundary",
              "performance_share"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "objective_id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "title": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "metric_type": {
                "const": "milestone"
              },
              "start_value": {
                "const": 0
              },
              "target_value": {
                "const": 1
              },
              "unit": {
                "type": "null"
              },
              "cadence": {
                "type": "null"
              },
              "per": {
                "type": "null"
              },
              "since": {
                "type": "null"
              },
              "status": {
                "enum": [
                  "in_progress",
                  "completed"
                ],
                "type": "string",
                "description": "Result status: In progress or Completed. Reaching the target does not automatically mark the result completed."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "short_code": {
                "type": "string",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "current_value": {
                "anyOf": [
                  {
                    "const": 0
                  },
                  {
                    "const": 1
                  }
                ]
              },
              "boundary_value": {
                "anyOf": [
                  {
                    "const": 0
                  },
                  {
                    "const": 1
                  }
                ]
              },
              "progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "boundary_progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement_pp": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "evidence_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "last_recorded_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_expected_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_logs_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "performance_share": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "objective_id",
              "title",
              "description",
              "metric_type",
              "start_value",
              "target_value",
              "unit",
              "cadence",
              "per",
              "since",
              "status",
              "created_at",
              "short_code",
              "url",
              "current_value",
              "boundary_value",
              "progress_pct",
              "boundary_progress_pct",
              "movement",
              "movement_pp",
              "evidence_count",
              "last_recorded_at",
              "habit_expected_since_boundary",
              "habit_logs_since_boundary",
              "performance_share"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "objective_id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "title": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "metric_type": {
                "const": "habit"
              },
              "start_value": {
                "const": 0
              },
              "target_value": {
                "const": 100
              },
              "unit": {
                "type": "null"
              },
              "cadence": {
                "enum": [
                  "weekly",
                  "monthly"
                ],
                "type": "string",
                "description": "UI label: Cadence. Weekly or Monthly; per supplies the Times value."
              },
              "per": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "exclusiveMinimum": 0
              },
              "since": {
                "type": "string",
                "format": "date",
                "description": "Calendar date as YYYY-MM-DD in the profile timezone."
              },
              "status": {
                "enum": [
                  "in_progress",
                  "completed"
                ],
                "type": "string",
                "description": "Result status: In progress or Completed. Reaching the target does not automatically mark the result completed."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "short_code": {
                "type": "string",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "current_value": {
                "type": "number",
                "description": "Current value displayed in the result headline; derived according to metric type from its baseline and retained evidence."
              },
              "boundary_value": {
                "type": "number"
              },
              "progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "boundary_progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement_pp": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "evidence_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "last_recorded_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_expected_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_logs_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "performance_share": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "objective_id",
              "title",
              "description",
              "metric_type",
              "start_value",
              "target_value",
              "unit",
              "cadence",
              "per",
              "since",
              "status",
              "created_at",
              "short_code",
              "url",
              "current_value",
              "boundary_value",
              "progress_pct",
              "boundary_progress_pct",
              "movement",
              "movement_pp",
              "evidence_count",
              "last_recorded_at",
              "habit_expected_since_boundary",
              "habit_logs_since_boundary",
              "performance_share"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "objective_id": {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              "title": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "metric_type": {
                "const": "performance"
              },
              "start_value": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "UI label: Start. Metric baseline; habit baselines are derived rather than stored."
              },
              "target_value": {
                "type": "number"
              },
              "unit": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "UI label: Unit. Used by Number and Performance results."
              },
              "cadence": {
                "type": "null"
              },
              "per": {
                "type": "null"
              },
              "since": {
                "type": "string",
                "format": "date",
                "description": "Calendar date as YYYY-MM-DD in the profile timezone."
              },
              "status": {
                "enum": [
                  "in_progress",
                  "completed"
                ],
                "type": "string",
                "description": "Result status: In progress or Completed. Reaching the target does not automatically mark the result completed."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "short_code": {
                "type": "string",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "current_value": {
                "type": "number",
                "description": "Current value displayed in the result headline; derived according to metric type from its baseline and retained evidence."
              },
              "boundary_value": {
                "type": "number"
              },
              "progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "boundary_progress_pct": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "movement_pp": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "evidence_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "last_recorded_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_expected_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "habit_logs_since_boundary": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "performance_share": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "objective_id",
              "title",
              "description",
              "metric_type",
              "start_value",
              "target_value",
              "unit",
              "cadence",
              "per",
              "since",
              "status",
              "created_at",
              "short_code",
              "url",
              "current_value",
              "boundary_value",
              "progress_pct",
              "boundary_progress_pct",
              "movement",
              "movement_pp",
              "evidence_count",
              "last_recorded_at",
              "habit_expected_since_boundary",
              "habit_logs_since_boundary",
              "performance_share"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Action": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "cycle_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "objective_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "due_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "description": "Calendar date as YYYY-MM-DD in the profile timezone."
              },
              {
                "type": "null"
              }
            ],
            "description": "UI label: Due. May be unset on a web draft; a set date cannot be cleared."
          },
          "status": {
            "enum": [
              "open",
              "in_progress",
              "done"
            ],
            "type": "string",
            "description": "Action status: Open, In progress or Done. The To do UI group includes Open and In progress; Overdue is derived, not a status."
          },
          "sort_order": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Drag order within an action group; not a progress status."
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "overdue": {
            "type": "boolean"
          },
          "done_since_boundary": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "cycle_id",
          "objective_id",
          "title",
          "description",
          "due_at",
          "status",
          "sort_order",
          "session_id",
          "created_at",
          "url",
          "overdue",
          "done_since_boundary"
        ],
        "additionalProperties": false
      },
      "Note": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "text": {
            "type": "string",
            "minLength": 1
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "since_boundary": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "text",
          "recorded_at",
          "url",
          "since_boundary"
        ],
        "additionalProperties": false
      },
      "Session": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "vendor": {
            "enum": [
              "claude",
              "openai"
            ],
            "type": "string",
            "description": "Conversation host: claude is shown as Claude; openai is shown as ChatGPT."
          },
          "source_url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "null"
              }
            ],
            "description": "External conversation link used by Open the conversation. Not the app detail URL."
          },
          "type": {
            "anyOf": [
              {
                "enum": [
                  "goal_setup",
                  "check_in",
                  "review",
                  "open_coaching"
                ],
                "type": "string",
                "description": "Coaching session type: Goal setup, Check-in, Review or Open coaching. Separate from whether the session is still open."
              },
              {
                "type": "null"
              }
            ]
          },
          "briefing_notes": {
            "type": "string",
            "description": "UI document: Briefing. Server-prepared coaching context."
          },
          "headline": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "One-line coaching-session summary used in session lists."
          },
          "summary_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "UI document: Summary. Saved when the coaching session closes."
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "ended_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Closed when set; In progress when null. This is derived session state, not a stored status enum."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Internal app link to coaching session details; distinct from source_url."
          },
          "duration_minutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "actions_created": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "actions_reviewed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "vendor",
          "source_url",
          "type",
          "briefing_notes",
          "headline",
          "summary_notes",
          "started_at",
          "ended_at",
          "url",
          "duration_minutes",
          "actions_created",
          "actions_reviewed"
        ],
        "additionalProperties": false
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "name": {
            "type": "string",
            "description": "Chosen coaching/display name, used verbatim. Target UI prompt: What should we call you? Empty means unknown; no separate surname."
          },
          "about_me": {
            "type": "string",
            "description": "UI label: About me."
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "description": "UI label: Time zone. IANA zone used for calendar dates and boundaries."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "subscription_status": {
            "enum": [
              "incomplete",
              "active",
              "past_due",
              "canceled"
            ],
            "type": "string",
            "description": "Derived from subscription, not a User column: active = Active, past_due = Payment failed, canceled = Canceled, incomplete = Awaiting payment. Only active grants paid access. Scheduled cancellation uses the separate flag; it is not a fifth status."
          },
          "subscription_cancel_at_period_end": {
            "type": "boolean",
            "description": "Derived from the selected local subscription; false when none exists."
          },
          "subscription_current_period_end": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Derived from the selected local subscription; null when none exists."
          },
          "connected": {
            "type": "boolean",
            "description": "True when an OAuth consent row exists for this user, for any client. Indicates prior authorization for onboarding, not current connector liveness."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "about_me",
          "timezone",
          "email",
          "subscription_status",
          "subscription_cancel_at_period_end",
          "subscription_current_period_end",
          "connected",
          "created_at"
        ],
        "additionalProperties": false,
        "description": "Account view: chosen name and profile from user, billing state from subscription, and connected from oauth_consent. Auth credentials and provider tokens are not exposed."
      },
      "ResultLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "result_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "comment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              {
                "type": "null"
              }
            ]
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "result_id",
          "value",
          "comment",
          "session_id",
          "recorded_at"
        ],
        "additionalProperties": false,
        "description": "Result log stored in result_logs. The UI shows value entries under Updates and their non-empty comments under Comments. Value may be null for a comment-only habit entry; evidence and timestamps are immutable."
      },
      "HabitLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "result_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "day": {
            "type": "string",
            "format": "date",
            "description": "Calendar date as YYYY-MM-DD in the profile timezone."
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "result_id",
          "day",
          "session_id",
          "created_at"
        ],
        "additionalProperties": false,
        "description": "Habit log stored in habit_logs. The UI marks calendar days and lists them under Updates with the Marked column. One row per result/day; unmarking deletes the row. This is not append-only history."
      },
      "ActionLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "action_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
          },
          "status": {
            "enum": [
              "open",
              "in_progress",
              "done"
            ],
            "type": "string",
            "description": "Action status: Open, In progress or Done. The To do UI group includes Open and In progress; Overdue is derived, not a status."
          },
          "comment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
              },
              {
                "type": "null"
              }
            ]
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "action_id",
          "status",
          "comment",
          "session_id",
          "recorded_at"
        ],
        "additionalProperties": false,
        "description": "Action log stored in action_logs. Records a status observation and optional comment. Action detail shows Comments, a filtered view rather than the complete status history; status and timestamps are immutable, and only the comment may be cleared."
      }
    }
  },
  "paths": {
    "/example/list": {
      "post": {
        "operationId": "example.list",
        "summary": "List",
        "description": "**Implemented scaffold example**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Example"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      },
                      "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "x-native-type": "date"
                      },
                      "stale": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "created_at",
                      "stale"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "implemented",
        "x-access-policy": "retained-read"
      }
    },
    "/example/create": {
      "post": {
        "operationId": "example.create",
        "summary": "Create",
        "description": "**Implemented scaffold example**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Example"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "x-native-type": "date"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "created_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "implemented",
        "x-access-policy": "entitled-write"
      }
    },
    "/example/delete": {
      "post": {
        "operationId": "example.delete",
        "summary": "Delete",
        "description": "**Implemented scaffold example**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Example"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "id"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "implemented",
        "x-access-policy": "entitled-write"
      }
    },
    "/user/get": {
      "post": {
        "operationId": "user.get",
        "summary": "Read profile and subscription",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.\n\nRead the authenticated account profile with locally derived subscription state and onboarding connection status. No live billing request; no auth credentials in the response.",
        "tags": [
          "User"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/user/update": {
      "post": {
        "operationId": "user.update",
        "summary": "Edit profile",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `account-management`. Identity is resolved server-side.\n\nEdit the chosen name, About me and time zone. An account action, not a paid coaching write: it stays available on the web when the subscription is past due, canceled or incomplete. The chat tool user_update still requires an active subscription.",
        "tags": [
          "User"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Chosen coaching/display name; use verbatim. Omit to preserve, empty text clears it."
                  },
                  "about_me": {
                    "type": "string",
                    "maxLength": 4000,
                    "description": "UI label: About me. Coaching context; omit to preserve, empty text clears it, null is invalid."
                  },
                  "timezone": {
                    "type": "string",
                    "description": "UI label: Time zone. IANA zone used for calendar dates and boundaries."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                        },
                        "name": {
                          "type": "string",
                          "description": "Chosen coaching/display name, used verbatim. Target UI prompt: What should we call you? Empty means unknown; no separate surname."
                        },
                        "about_me": {
                          "type": "string",
                          "description": "UI label: About me."
                        },
                        "timezone": {
                          "type": "string",
                          "minLength": 1,
                          "description": "UI label: Time zone. IANA zone used for calendar dates and boundaries."
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "about_me",
                        "timezone"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "account-management"
      }
    },
    "/user/delete": {
      "post": {
        "operationId": "user.delete",
        "summary": "Delete account",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `account-management`. Identity is resolved server-side.\n\nWeb-only account deletion. Requires fresh identity confirmation; do not infer authorization from possession of an account ID.",
        "tags": [
          "User"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "password": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "password"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "account-management"
      }
    },
    "/billing/create_checkout_session": {
      "post": {
        "operationId": "billing.create_checkout_session",
        "summary": "Subscribe or resubscribe (open checkout)",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `account-management`. Identity is resolved server-side.\n\nCreate a checkout session for a new subscription: the first one from Onboarding, or a replacement from the Settings action Resubscribe after a canceled plan. The billing portal cannot start a subscription. The existing billing customer is reused. Refused with CONFLICT when an active or past-due subscription exists; those are managed in the billing portal. A browser return from checkout does not establish entitlement; subscription state follows verified billing events.",
        "tags": [
          "Billing"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "account-management"
      }
    },
    "/billing/create_portal_session": {
      "post": {
        "operationId": "billing.create_portal_session",
        "summary": "Manage subscription (open billing portal)",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `account-management`. Identity is resolved server-side.\n\nReturn a billing portal URL for the authenticated account; the client opens it for the Settings actions Manage subscription and Fix payment. It manages an existing subscription and cannot start a new one. A billing portal session is separate from a coaching session.",
        "tags": [
          "Billing"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "account-management"
      }
    },
    "/billing/get_details": {
      "post": {
        "operationId": "billing.get_details",
        "summary": "Read billing details (Settings)",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `account-management`. Identity is resolved server-side.\n\nWeb-only read of the selected subscription plan, price and effective payment method for Settings. The account and customer resolve server-side. This is the only read that may contact the billing provider; user.get and coaching reads never do. No subscription returns null plan and payment method without a provider call. A transient provider failure returns SERVICE_UNAVAILABLE with error_code billing_details_unavailable; unsupported or unresolvable billing data also fails explicitly and is never reported as no subscription. Display only: it never grants entitlement, and a portal return re-reads it. Not an MCP tool.",
        "tags": [
          "Billing"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "description": "UI label: Plan. Provider-backed name of the selected plan."
                            },
                            "amount_minor": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991,
                              "description": "UI label: Price. Recurring plan amount in the currency minor unit; not an invoice total or a tax/credit promise."
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$",
                              "description": "Three-letter currency code, upper case."
                            },
                            "interval": {
                              "const": "month",
                              "description": "One monthly plan only."
                            },
                            "interval_count": {
                              "const": 1
                            }
                          },
                          "required": [
                            "name",
                            "amount_minor",
                            "currency",
                            "interval",
                            "interval_count"
                          ],
                          "additionalProperties": false,
                          "description": "The selected subscription plan, read from the billing provider."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Null when the account has no subscription (shown as No subscription)."
                    },
                    "payment_method": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "display": {
                              "type": "string",
                              "minLength": 1,
                              "description": "UI label: Payment method. Display text only, for example Visa ending in 4242; never a full number, token or provider object."
                            }
                          },
                          "required": [
                            "display"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Null when no payment method applies (shown as No payment method); never a provider failure."
                    },
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When these display details were fetched; not a subscription event ordering token."
                    }
                  },
                  "required": [
                    "plan",
                    "payment_method",
                    "retrieved_at"
                  ],
                  "additionalProperties": false,
                  "description": "Settings billing details. Display only: never grants or denies entitlement and is never persisted."
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "503",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "SERVICE_UNAVAILABLE"
                        },
                        "status": {
                          "const": 503
                        },
                        "message": {
                          "type": "string",
                          "default": "Service Unavailable"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "billing_details_unavailable"
                            },
                            "message": {
                              "type": "string",
                              "description": "Sanitized text: Billing details are temporarily unavailable."
                            },
                            "retryable": {
                              "const": true
                            }
                          },
                          "required": [
                            "error_code",
                            "message",
                            "retryable"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "account-management"
      }
    },
    "/cycles/create": {
      "post": {
        "operationId": "cycles.create",
        "summary": "Start a cycle",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nCreate a cycle and archive the prior active cycle. Reuse the idempotency key and identical fields for retries. End date must be after start date. Original-outcome replay is a service obligation.",
        "tags": [
          "Cycles"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start_at": {
                    "type": "string",
                    "format": "date",
                    "description": "UI label: Starts. Calendar date, YYYY-MM-DD. Required on create; omit on update to preserve."
                  },
                  "end_at": {
                    "type": "string",
                    "format": "date",
                    "description": "UI label: Ends. Calendar date, YYYY-MM-DD; must be after the resulting start date."
                  },
                  "intention": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Personal focus. Omit to preserve on update; null clears it."
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "description": "Unique key per logical create. Reuse the same key AND fields on every retry, including uncertain outcomes. A new create needs a new key."
                  }
                },
                "required": [
                  "start_at",
                  "end_at",
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "objectives": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Objective"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "cycle",
                        "objectives",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/cycles/resolve_active": {
      "post": {
        "operationId": "cycles.resolve_active",
        "summary": "Resolve the active cycle and reconcile expiry",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.\n\nResolve the active cycle with lazy expiry. This operation may archive an expired cycle; it differs from the MCP stored-active lookup.",
        "tags": [
          "Cycles"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Cycle"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/cycles/get": {
      "post": {
        "operationId": "cycles.get",
        "summary": "Read cycle details",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Cycles"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cycle": {
                      "$ref": "#/components/schemas/Cycle"
                    },
                    "objectives": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/Objective"
                          }
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "next_cursor"
                      ],
                      "additionalProperties": false
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "cycle",
                    "objectives",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/cycles/list": {
      "post": {
        "operationId": "cycles.list",
        "summary": "List cycles",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Cycles"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/Cycle"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/cycles/update": {
      "post": {
        "operationId": "cycles.update",
        "summary": "Edit cycle details or status",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nPatch an owned cycle by UUID or the stored active selector. Omitted fields stay unchanged; null intention clears it. Validate date ordering after merging with stored dates. Activating a cycle archives the incumbent.",
        "tags": [
          "Cycles"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      {
                        "const": "active"
                      }
                    ],
                    "description": "Owned cycle UUID from fresh context, or active for the stored active cycle at execution. No date-based expiry or fallback. Use the UUID for a specifically selected cycle."
                  },
                  "start_at": {
                    "type": "string",
                    "format": "date",
                    "description": "UI label: Starts. Calendar date, YYYY-MM-DD. Required on create; omit on update to preserve."
                  },
                  "end_at": {
                    "type": "string",
                    "format": "date",
                    "description": "UI label: Ends. Calendar date, YYYY-MM-DD; must be after the resulting start date."
                  },
                  "intention": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Personal focus. Omit to preserve on update; null clears it."
                  },
                  "status": {
                    "enum": [
                      "active",
                      "archived"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "objectives": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Objective"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "cycle",
                        "objectives",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/cycles/preview_deletion": {
      "post": {
        "operationId": "cycles.preview_deletion",
        "summary": "Preview cycle deletion impact",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nCompute complete deletion impact and return a trusted application approval URL. A preview does not authorize deletion. Fail closed when impact cannot be established.",
        "tags": [
          "Cycles"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "operation": {
                      "const": "preview"
                    },
                    "preview_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "cycle": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                        },
                        "start_at": {
                          "type": "string",
                          "format": "date",
                          "description": "UI label: Starts."
                        },
                        "end_at": {
                          "type": "string",
                          "format": "date",
                          "description": "UI label: Ends."
                        },
                        "status": {
                          "enum": [
                            "active",
                            "archived"
                          ],
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "start_at",
                        "end_at",
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    "deleted": {
                      "type": "object",
                      "properties": {
                        "cycles": {
                          "const": 1
                        },
                        "objectives": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "results": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "result_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "habit_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "actions": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "action_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "cycles",
                        "objectives",
                        "results",
                        "result_logs",
                        "habit_logs",
                        "actions",
                        "action_logs"
                      ],
                      "additionalProperties": false
                    },
                    "retained": {
                      "type": "array",
                      "prefixItems": [
                        {
                          "const": "notes"
                        },
                        {
                          "const": "sessions"
                        }
                      ]
                    },
                    "active_remaining": {
                      "type": "boolean"
                    },
                    "approval": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "const": "required"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "status",
                        "url"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "operation",
                    "preview_id",
                    "expires_at",
                    "cycle",
                    "deleted",
                    "retained",
                    "active_remaining",
                    "approval"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/cycles/delete": {
      "post": {
        "operationId": "cycles.delete",
        "summary": "Delete cycle",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nPermanently delete the cycle and its dependants only after checking actor-bound application approval, preview expiry and unchanged impact in the transaction. A preview ID alone is not approval.",
        "tags": [
          "Cycles"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "preview_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Server-issued impact preview ID. This is not approval: the service checks genuine user approval recorded by the trusted host/application."
                  }
                },
                "required": [
                  "id",
                  "preview_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    },
                    "active_remaining": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "active_remaining"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/objectives/preview_deletion": {
      "post": {
        "operationId": "objectives.preview_deletion",
        "summary": "Preview objective deletion impact",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nReturn complete server impact and a trusted application approval URL. Missing impact or approval blocks deletion; preview possession is not consent.",
        "tags": [
          "Objectives"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "operation": {
                      "const": "preview"
                    },
                    "preview_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "target": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                        },
                        "title": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "title"
                      ],
                      "additionalProperties": false
                    },
                    "deleted": {
                      "type": "object",
                      "properties": {
                        "objectives": {
                          "const": 1
                        },
                        "results": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "result_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "habit_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "actions": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "action_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "objectives",
                        "results",
                        "result_logs",
                        "habit_logs",
                        "actions",
                        "action_logs"
                      ],
                      "additionalProperties": false
                    },
                    "approval": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "const": "required"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "status",
                        "url"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "operation",
                    "preview_id",
                    "expires_at",
                    "target",
                    "deleted",
                    "approval"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/objectives/create": {
      "post": {
        "operationId": "objectives.create",
        "summary": "Add objective",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Objectives"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "deadline_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "UI label: Deadline. Optional; omitted or null creates the objective with no deadline."
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "title",
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "objective": {
                          "$ref": "#/components/schemas/Objective"
                        },
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "results": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Result"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "actions": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Action"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "objective",
                        "cycle",
                        "results",
                        "actions",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/objectives/list": {
      "post": {
        "operationId": "objectives.list",
        "summary": "List objectives",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Objectives"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "cycle_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/Objective"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/objectives/get": {
      "post": {
        "operationId": "objectives.get",
        "summary": "Read objective details",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Objectives"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "objective": {
                      "$ref": "#/components/schemas/Objective"
                    },
                    "cycle": {
                      "$ref": "#/components/schemas/Cycle"
                    },
                    "results": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/Result"
                          }
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "next_cursor"
                      ],
                      "additionalProperties": false
                    },
                    "actions": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/Action"
                          }
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "next_cursor"
                      ],
                      "additionalProperties": false
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "objective",
                    "cycle",
                    "results",
                    "actions",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/objectives/update": {
      "post": {
        "operationId": "objectives.update",
        "summary": "Edit objective",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Objectives"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "deadline_at": {
                    "type": "string",
                    "format": "date",
                    "description": "UI label: Deadline. Omit to preserve; a date sets or replaces it. A deadline cannot be cleared, so null is rejected."
                  },
                  "status": {
                    "enum": [
                      "on_track",
                      "off_track",
                      "completed"
                    ],
                    "type": "string",
                    "description": "Objective status: On track, Off track or Completed. Coaching judgment, independent of the derived Progress percentage."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "objective": {
                          "$ref": "#/components/schemas/Objective"
                        },
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "results": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Result"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "actions": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Action"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "objective",
                        "cycle",
                        "results",
                        "actions",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/objectives/delete": {
      "post": {
        "operationId": "objectives.delete",
        "summary": "Delete objective",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nPermanently delete an owned objective. Requires an actor/target/impact/expiry-bound server preview and genuine application approval, checked and consumed atomically with deletion. Fail closed on incomplete or changed impact.",
        "tags": [
          "Objectives"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "preview_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Server impact preview ID; trusted application approval must already exist."
                  }
                },
                "required": [
                  "id",
                  "preview_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/results/preview_deletion": {
      "post": {
        "operationId": "results.preview_deletion",
        "summary": "Preview result deletion impact",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nReturn complete server impact and a trusted application approval URL. Missing impact or approval blocks deletion; preview possession is not consent.",
        "tags": [
          "Results"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "operation": {
                      "const": "preview"
                    },
                    "preview_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "target": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                        },
                        "title": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "title"
                      ],
                      "additionalProperties": false
                    },
                    "deleted": {
                      "type": "object",
                      "properties": {
                        "results": {
                          "const": 1
                        },
                        "result_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "habit_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "results",
                        "result_logs",
                        "habit_logs"
                      ],
                      "additionalProperties": false
                    },
                    "approval": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "const": "required"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "status",
                        "url"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "operation",
                    "preview_id",
                    "expires_at",
                    "target",
                    "deleted",
                    "approval"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/results/create": {
      "post": {
        "operationId": "results.create",
        "summary": "Add result",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Results"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "objective_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "metric_type": {
                        "const": "number"
                      },
                      "start_value": {
                        "type": "number"
                      },
                      "target_value": {
                        "type": "number"
                      },
                      "unit": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "idempotency_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      }
                    },
                    "required": [
                      "objective_id",
                      "title",
                      "metric_type",
                      "target_value",
                      "idempotency_key"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "objective_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "metric_type": {
                        "const": "percentage"
                      },
                      "start_value": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "target_value": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "idempotency_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      }
                    },
                    "required": [
                      "objective_id",
                      "title",
                      "metric_type",
                      "target_value",
                      "idempotency_key"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "objective_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "metric_type": {
                        "const": "milestone"
                      },
                      "idempotency_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      }
                    },
                    "required": [
                      "objective_id",
                      "title",
                      "metric_type",
                      "idempotency_key"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "objective_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "metric_type": {
                        "const": "habit"
                      },
                      "cadence": {
                        "enum": [
                          "weekly",
                          "monthly"
                        ],
                        "type": "string",
                        "description": "UI label: Cadence. Weekly or Monthly; per supplies the Times value."
                      },
                      "per": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991,
                        "description": "UI label: Times per selected Cadence."
                      },
                      "since": {
                        "type": "string",
                        "format": "date",
                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                      },
                      "idempotency_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      }
                    },
                    "required": [
                      "objective_id",
                      "title",
                      "metric_type",
                      "cadence",
                      "per",
                      "idempotency_key"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "objective_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "metric_type": {
                        "const": "performance"
                      },
                      "start_value": {
                        "type": "number"
                      },
                      "target_value": {
                        "type": "number"
                      },
                      "unit": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "since": {
                        "type": "string",
                        "format": "date",
                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                      },
                      "idempotency_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      }
                    },
                    "required": [
                      "objective_id",
                      "title",
                      "metric_type",
                      "target_value",
                      "idempotency_key"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Result"
                        },
                        "parents": {
                          "type": "object",
                          "properties": {
                            "cycle": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Cycle"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "objectives": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "$ref": "#/components/schemas/Objective"
                                  }
                                },
                                "next_cursor": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "items",
                                "next_cursor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "cycle",
                            "objectives"
                          ],
                          "additionalProperties": false
                        },
                        "result_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ResultLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "habit_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/HabitLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "trend": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "value"
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "pace": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "at",
                                      "value",
                                      "pace"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "habit"
                                      },
                                      "from": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "to": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "actual": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "expected": {
                                        "type": "number"
                                      },
                                      "expected_full": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "from",
                                      "to",
                                      "actual",
                                      "expected",
                                      "expected_full"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "performance"
                                      },
                                      "id": {
                                        "type": "string",
                                        "format": "uuid",
                                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "target": {
                                        "type": "number"
                                      },
                                      "gap": {
                                        "type": "number"
                                      },
                                      "share": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "at",
                                      "value",
                                      "target",
                                      "gap",
                                      "share"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "result",
                        "parents",
                        "result_logs",
                        "habit_logs",
                        "trend",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/results/list": {
      "post": {
        "operationId": "results.list",
        "summary": "List results",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Results"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "objective_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "cycle_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "List results across one cycle instead of a single objective. Supply exactly one parent selector."
                  },
                  "attention": {
                    "enum": [
                      "never_updated",
                      "silent",
                      "unmarked"
                    ],
                    "type": "string",
                    "description": "Optional briefing subset: no evidence ever, no update in the window, or habit with no mark in the window."
                  },
                  "window": {
                    "type": "object",
                    "properties": {
                      "since": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "until": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "since",
                      "until"
                    ],
                    "additionalProperties": false,
                    "description": "Required for silent/unmarked attention. Use exact server-resolved briefing bounds; current result figures remain current."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/Result"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/results/get": {
      "post": {
        "operationId": "results.get",
        "summary": "Read result details",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Results"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/Result"
                    },
                    "parents": {
                      "type": "object",
                      "properties": {
                        "cycle": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Cycle"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "objectives": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Objective"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "cycle",
                        "objectives"
                      ],
                      "additionalProperties": false
                    },
                    "result_logs": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "maxItems": 100,
                          "items": {
                            "$ref": "#/components/schemas/ResultLog"
                          }
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "next_cursor"
                      ],
                      "additionalProperties": false
                    },
                    "habit_logs": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "maxItems": 100,
                          "items": {
                            "$ref": "#/components/schemas/HabitLog"
                          }
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "next_cursor"
                      ],
                      "additionalProperties": false
                    },
                    "trend": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "maxItems": 100,
                          "items": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "const": "value"
                                  },
                                  "at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "value": {
                                    "type": "number"
                                  },
                                  "pace": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "at",
                                  "value",
                                  "pace"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "const": "habit"
                                  },
                                  "from": {
                                    "type": "string",
                                    "format": "date",
                                    "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                  },
                                  "to": {
                                    "type": "string",
                                    "format": "date",
                                    "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                  },
                                  "actual": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expected": {
                                    "type": "number"
                                  },
                                  "expected_full": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "from",
                                  "to",
                                  "actual",
                                  "expected",
                                  "expected_full"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "const": "performance"
                                  },
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                  },
                                  "at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "value": {
                                    "type": "number"
                                  },
                                  "target": {
                                    "type": "number"
                                  },
                                  "gap": {
                                    "type": "number"
                                  },
                                  "share": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "id",
                                  "at",
                                  "value",
                                  "target",
                                  "gap",
                                  "share"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "next_cursor"
                      ],
                      "additionalProperties": false
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "result",
                    "parents",
                    "result_logs",
                    "habit_logs",
                    "trend",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/results/update": {
      "post": {
        "operationId": "results.update",
        "summary": "Edit result",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Results"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "objective_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "metric_type": {
                    "enum": [
                      "number",
                      "percentage",
                      "milestone",
                      "habit",
                      "performance"
                    ],
                    "type": "string",
                    "description": "UI label: Type. Number, Percentage, Milestone, Habit or Performance."
                  },
                  "target_value": {
                    "type": "number"
                  },
                  "start_value": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unit": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cadence": {
                    "enum": [
                      "weekly",
                      "monthly"
                    ],
                    "type": "string",
                    "description": "UI label: Cadence. Weekly or Monthly; per supplies the Times value."
                  },
                  "per": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991,
                    "description": "UI label: Times per selected Cadence."
                  },
                  "since": {
                    "type": "string",
                    "format": "date",
                    "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                  },
                  "status": {
                    "enum": [
                      "in_progress",
                      "completed"
                    ],
                    "type": "string",
                    "description": "Result status: In progress or Completed. Reaching the target does not automatically mark the result completed."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Result"
                        },
                        "parents": {
                          "type": "object",
                          "properties": {
                            "cycle": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Cycle"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "objectives": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "$ref": "#/components/schemas/Objective"
                                  }
                                },
                                "next_cursor": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "items",
                                "next_cursor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "cycle",
                            "objectives"
                          ],
                          "additionalProperties": false
                        },
                        "result_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ResultLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "habit_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/HabitLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "trend": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "value"
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "pace": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "at",
                                      "value",
                                      "pace"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "habit"
                                      },
                                      "from": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "to": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "actual": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "expected": {
                                        "type": "number"
                                      },
                                      "expected_full": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "from",
                                      "to",
                                      "actual",
                                      "expected",
                                      "expected_full"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "performance"
                                      },
                                      "id": {
                                        "type": "string",
                                        "format": "uuid",
                                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "target": {
                                        "type": "number"
                                      },
                                      "gap": {
                                        "type": "number"
                                      },
                                      "share": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "at",
                                      "value",
                                      "target",
                                      "gap",
                                      "share"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "result",
                        "parents",
                        "result_logs",
                        "habit_logs",
                        "trend",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/results/delete": {
      "post": {
        "operationId": "results.delete",
        "summary": "Delete result",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nPermanently delete an owned result. Requires an actor/target/impact/expiry-bound server preview and genuine application approval, checked and consumed atomically with deletion. Fail closed on incomplete or changed impact.",
        "tags": [
          "Results"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "preview_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Server impact preview ID; trusted application approval must already exist."
                  }
                },
                "required": [
                  "id",
                  "preview_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/result_logs/create": {
      "post": {
        "operationId": "result_logs.create",
        "summary": "Add result log (update or comment)",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nAppend result evidence or a comment as a result log. Reuse the idempotency key on retries; current result figures are derived from retained logs.",
        "tags": [
          "Result logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "result_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "value": {
                    "type": "number"
                  },
                  "comment": {
                    "type": "string",
                    "minLength": 1
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "result_id",
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Result"
                        },
                        "parents": {
                          "type": "object",
                          "properties": {
                            "cycle": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Cycle"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "objectives": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "$ref": "#/components/schemas/Objective"
                                  }
                                },
                                "next_cursor": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "items",
                                "next_cursor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "cycle",
                            "objectives"
                          ],
                          "additionalProperties": false
                        },
                        "result_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ResultLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "habit_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/HabitLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "trend": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "value"
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "pace": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "at",
                                      "value",
                                      "pace"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "habit"
                                      },
                                      "from": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "to": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "actual": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "expected": {
                                        "type": "number"
                                      },
                                      "expected_full": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "from",
                                      "to",
                                      "actual",
                                      "expected",
                                      "expected_full"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "performance"
                                      },
                                      "id": {
                                        "type": "string",
                                        "format": "uuid",
                                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "target": {
                                        "type": "number"
                                      },
                                      "gap": {
                                        "type": "number"
                                      },
                                      "share": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "at",
                                      "value",
                                      "target",
                                      "gap",
                                      "share"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "result",
                        "parents",
                        "result_logs",
                        "habit_logs",
                        "trend",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/result_logs/list": {
      "post": {
        "operationId": "result_logs.list",
        "summary": "List result logs (Updates and Comments)",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.\n\nRead a bounded page of result logs for the selected result, newest first.",
        "tags": [
          "Result logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "result_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "result_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/ResultLog"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/result_logs/clear_comment": {
      "post": {
        "operationId": "result_logs.clear_comment",
        "summary": "Clear comment from result log",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Result logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Result"
                        },
                        "parents": {
                          "type": "object",
                          "properties": {
                            "cycle": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Cycle"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "objectives": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "$ref": "#/components/schemas/Objective"
                                  }
                                },
                                "next_cursor": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "items",
                                "next_cursor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "cycle",
                            "objectives"
                          ],
                          "additionalProperties": false
                        },
                        "result_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ResultLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "habit_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/HabitLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "trend": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "value"
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "pace": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "at",
                                      "value",
                                      "pace"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "habit"
                                      },
                                      "from": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "to": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "actual": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "expected": {
                                        "type": "number"
                                      },
                                      "expected_full": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "from",
                                      "to",
                                      "actual",
                                      "expected",
                                      "expected_full"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "performance"
                                      },
                                      "id": {
                                        "type": "string",
                                        "format": "uuid",
                                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "target": {
                                        "type": "number"
                                      },
                                      "gap": {
                                        "type": "number"
                                      },
                                      "share": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "at",
                                      "value",
                                      "target",
                                      "gap",
                                      "share"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "result",
                        "parents",
                        "result_logs",
                        "habit_logs",
                        "trend",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/result_logs/delete": {
      "post": {
        "operationId": "result_logs.delete",
        "summary": "Delete result log (update)",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Result logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Result"
                        },
                        "parents": {
                          "type": "object",
                          "properties": {
                            "cycle": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Cycle"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "objectives": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "$ref": "#/components/schemas/Objective"
                                  }
                                },
                                "next_cursor": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "items",
                                "next_cursor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "cycle",
                            "objectives"
                          ],
                          "additionalProperties": false
                        },
                        "result_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ResultLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "habit_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/HabitLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "trend": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "value"
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "pace": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "at",
                                      "value",
                                      "pace"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "habit"
                                      },
                                      "from": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "to": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "actual": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "expected": {
                                        "type": "number"
                                      },
                                      "expected_full": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "from",
                                      "to",
                                      "actual",
                                      "expected",
                                      "expected_full"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "performance"
                                      },
                                      "id": {
                                        "type": "string",
                                        "format": "uuid",
                                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "target": {
                                        "type": "number"
                                      },
                                      "gap": {
                                        "type": "number"
                                      },
                                      "share": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "at",
                                      "value",
                                      "target",
                                      "gap",
                                      "share"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "result",
                        "parents",
                        "result_logs",
                        "habit_logs",
                        "trend",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/habit_logs/set": {
      "post": {
        "operationId": "habit_logs.set",
        "summary": "Mark or unmark a habit day",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nSet whether a habit happened on one calendar day. marked=true creates the habit log if absent; marked=false removes it. Repeating the same desired state is safe.",
        "tags": [
          "Habit logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "comment": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Optional evidence comment saved atomically with the requested habit day state."
                  },
                  "result_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "day": {
                    "type": "string",
                    "format": "date",
                    "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                  },
                  "marked": {
                    "type": "boolean",
                    "description": "Desired calendar state: true marks the day; false unmarks it. Not an append-only history event."
                  }
                },
                "required": [
                  "result_id",
                  "day",
                  "marked"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Result"
                        },
                        "parents": {
                          "type": "object",
                          "properties": {
                            "cycle": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Cycle"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "objectives": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "$ref": "#/components/schemas/Objective"
                                  }
                                },
                                "next_cursor": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "items",
                                "next_cursor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "cycle",
                            "objectives"
                          ],
                          "additionalProperties": false
                        },
                        "result_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ResultLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "habit_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/HabitLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "trend": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "value"
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "pace": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "at",
                                      "value",
                                      "pace"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "habit"
                                      },
                                      "from": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "to": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                                      },
                                      "actual": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "expected": {
                                        "type": "number"
                                      },
                                      "expected_full": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "from",
                                      "to",
                                      "actual",
                                      "expected",
                                      "expected_full"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "const": "performance"
                                      },
                                      "id": {
                                        "type": "string",
                                        "format": "uuid",
                                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                      },
                                      "at": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "target": {
                                        "type": "number"
                                      },
                                      "gap": {
                                        "type": "number"
                                      },
                                      "share": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "at",
                                      "value",
                                      "target",
                                      "gap",
                                      "share"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "result",
                        "parents",
                        "result_logs",
                        "habit_logs",
                        "trend",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/habit_logs/list": {
      "post": {
        "operationId": "habit_logs.list",
        "summary": "List habit logs (marked days)",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.\n\nRead a bounded cursor page of habit logs (checked days) for the selected result and optional inclusive date range. Preserve filters when following next_cursor.",
        "tags": [
          "Habit logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "result_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                  }
                },
                "required": [
                  "result_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/HabitLog"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/actions/preview_deletion": {
      "post": {
        "operationId": "actions.preview_deletion",
        "summary": "Preview action deletion impact",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nReturn complete server impact and a trusted application approval URL. Missing impact or approval blocks deletion; preview possession is not consent.",
        "tags": [
          "Actions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "operation": {
                      "const": "preview"
                    },
                    "preview_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "target": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                        },
                        "title": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "title"
                      ],
                      "additionalProperties": false
                    },
                    "deleted": {
                      "type": "object",
                      "properties": {
                        "actions": {
                          "const": 1
                        },
                        "action_logs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "actions",
                        "action_logs"
                      ],
                      "additionalProperties": false
                    },
                    "approval": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "const": "required"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "status",
                        "url"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "operation",
                    "preview_id",
                    "expires_at",
                    "target",
                    "deleted",
                    "approval"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/actions/create": {
      "post": {
        "operationId": "actions.create",
        "summary": "Add action",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Actions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "due_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "objective_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "title",
                  "due_at",
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "action": {
                          "$ref": "#/components/schemas/Action"
                        },
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "objective": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Objective"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "source_session": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Session"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "action_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ActionLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "action",
                        "cycle",
                        "objective",
                        "source_session",
                        "action_logs",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/actions/list": {
      "post": {
        "operationId": "actions.list",
        "summary": "List actions",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Actions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "cycle_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "objective_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "enum": [
                      "open",
                      "in_progress",
                      "done"
                    ],
                    "type": "string",
                    "description": "Action status: Open, In progress or Done. The To do UI group includes Open and In progress; Overdue is derived, not a status."
                  },
                  "due_before": {
                    "type": "string",
                    "format": "date",
                    "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                  },
                  "outstanding": {
                    "const": true,
                    "description": "Only open or in_progress actions; exclude done across every page."
                  },
                  "session_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Filter actions created in this owned session; combine with cycle_id to select its cycle explicitly."
                  },
                  "overdue": {
                    "const": true,
                    "description": "Only non-done actions before due_before; requires an explicit local cutoff date for stable briefing pagination."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/Action"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/actions/get": {
      "post": {
        "operationId": "actions.get",
        "summary": "Read action details",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Actions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "action": {
                      "$ref": "#/components/schemas/Action"
                    },
                    "cycle": {
                      "$ref": "#/components/schemas/Cycle"
                    },
                    "objective": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Objective"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "source_session": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Session"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "action_logs": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "maxItems": 100,
                          "items": {
                            "$ref": "#/components/schemas/ActionLog"
                          }
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "next_cursor"
                      ],
                      "additionalProperties": false
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "action",
                    "cycle",
                    "objective",
                    "source_session",
                    "action_logs",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/actions/update": {
      "post": {
        "operationId": "actions.update",
        "summary": "Edit action details",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nPatch action fields. Omit fields to preserve them; null may clear optional links and description, but cannot clear a set due date. Status changes belong to action-log creation; ordering belongs to actions.reorder.",
        "tags": [
          "Actions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "due_at": {
                    "type": "string",
                    "format": "date",
                    "description": "New due date. Omit to preserve; a previously set date cannot be cleared. Web creation may initially have no date."
                  },
                  "objective_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "session_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "action": {
                          "$ref": "#/components/schemas/Action"
                        },
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "objective": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Objective"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "source_session": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Session"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "action_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ActionLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "action",
                        "cycle",
                        "objective",
                        "source_session",
                        "action_logs",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/actions/reorder": {
      "post": {
        "operationId": "actions.reorder",
        "summary": "Reorder action",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Actions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "sort_order": {
                    "type": "number"
                  }
                },
                "required": [
                  "id",
                  "sort_order"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "action": {
                          "$ref": "#/components/schemas/Action"
                        },
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "objective": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Objective"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "source_session": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Session"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "action_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ActionLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "action",
                        "cycle",
                        "objective",
                        "source_session",
                        "action_logs",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/actions/delete": {
      "post": {
        "operationId": "actions.delete",
        "summary": "Delete action",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nPermanently delete an owned action. Requires an actor/target/impact/expiry-bound server preview and genuine application approval, checked and consumed atomically with deletion. Fail closed on incomplete or changed impact.",
        "tags": [
          "Actions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "preview_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Server impact preview ID; trusted application approval must already exist."
                  }
                },
                "required": [
                  "id",
                  "preview_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/action_logs/create": {
      "post": {
        "operationId": "action_logs.create",
        "summary": "Add action log (status or comment)",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nAppend an action log with a status and optional comment. The action status changes in the same transaction; repeating a status with a comment is a valid log entry.",
        "tags": [
          "Action logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "status": {
                    "enum": [
                      "open",
                      "in_progress",
                      "done"
                    ],
                    "type": "string",
                    "description": "Action status: Open, In progress or Done. The To do UI group includes Open and In progress; Overdue is derived, not a status."
                  },
                  "comment": {
                    "type": "string",
                    "minLength": 1
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "action_id",
                  "status",
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "action": {
                          "$ref": "#/components/schemas/Action"
                        },
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "objective": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Objective"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "source_session": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Session"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "action_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ActionLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "action",
                        "cycle",
                        "objective",
                        "source_session",
                        "action_logs",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/action_logs/list": {
      "post": {
        "operationId": "action_logs.list",
        "summary": "List action logs",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.\n\nRead a bounded page of action logs for the selected action, newest first.",
        "tags": [
          "Action logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "action_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "action_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/ActionLog"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/action_logs/clear_comment": {
      "post": {
        "operationId": "action_logs.clear_comment",
        "summary": "Clear comment from action log",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Action logs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": "object",
                      "properties": {
                        "action": {
                          "$ref": "#/components/schemas/Action"
                        },
                        "cycle": {
                          "$ref": "#/components/schemas/Cycle"
                        },
                        "objective": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Objective"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "source_session": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Session"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "action_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 100,
                              "items": {
                                "$ref": "#/components/schemas/ActionLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "action",
                        "cycle",
                        "objective",
                        "source_session",
                        "action_logs",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/notes/preview_deletion": {
      "post": {
        "operationId": "notes.preview_deletion",
        "summary": "Preview note deletion impact",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nReturn complete server impact and a trusted application approval URL. Missing impact or approval blocks deletion; preview possession is not consent.",
        "tags": [
          "Notes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "operation": {
                      "const": "preview"
                    },
                    "preview_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "target": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "id",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    "deleted": {
                      "type": "object",
                      "properties": {
                        "notes": {
                          "const": 1
                        }
                      },
                      "required": [
                        "notes"
                      ],
                      "additionalProperties": false
                    },
                    "approval": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "const": "required"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "status",
                        "url"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "operation",
                    "preview_id",
                    "expires_at",
                    "target",
                    "deleted",
                    "approval"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/notes/create": {
      "post": {
        "operationId": "notes.create",
        "summary": "New note",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Notes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "text",
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "$ref": "#/components/schemas/Note"
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/notes/update": {
      "post": {
        "operationId": "notes.update",
        "summary": "Edit note",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.",
        "tags": [
          "Notes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id",
                  "text"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "$ref": "#/components/schemas/Note"
                    },
                    "changed": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "enum": [
                              "user",
                              "cycle",
                              "objective",
                              "result",
                              "result_log",
                              "action",
                              "action_log",
                              "session",
                              "note",
                              "habit_log"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                          }
                        },
                        "required": [
                          "entity",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "record",
                    "changed",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/notes/list": {
      "post": {
        "operationId": "notes.list",
        "summary": "List notes",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Notes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "window": {
                    "type": "object",
                    "properties": {
                      "since": {
                        "anyOf": [
                          {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                              },
                              {
                                "type": "string",
                                "format": "date-time"
                              }
                            ]
                          },
                          {
                            "enum": [
                              "last_session",
                              "cycle_start"
                            ],
                            "type": "string"
                          }
                        ],
                        "description": "Inclusive lower bound. Default: last completed session, falling back to active-cycle start. Date-only values use the profile timezone."
                      },
                      "until": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                          },
                          {
                            "type": "string",
                            "format": "date-time"
                          }
                        ],
                        "description": "Exclusive upper bound; default is the server time captured on the first page."
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/Note"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/notes/get": {
      "post": {
        "operationId": "notes.get",
        "summary": "Read note",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Notes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/notes/delete": {
      "post": {
        "operationId": "notes.delete",
        "summary": "Delete note",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nPermanently delete an owned note. Requires an actor/target/impact/expiry-bound server preview and genuine application approval, checked and consumed atomically with deletion. Fail closed on incomplete or changed impact.",
        "tags": [
          "Notes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "preview_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Server impact preview ID; trusted application approval must already exist."
                  }
                },
                "required": [
                  "id",
                  "preview_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/sessions/start": {
      "post": {
        "operationId": "sessions.start",
        "summary": "Start or resume a coaching session and load its briefing",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `session-start`. Identity is resolved server-side.\n\nStarts or reuses a session and persists briefing notes; this operation has write effects. An unpaid account receives the declared enablement response instead of coaching state.",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "force_new": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "access_state": {
                          "const": "active"
                        },
                        "session": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                            },
                            "started_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "stale": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "started_at"
                          ],
                          "additionalProperties": false
                        },
                        "briefing_notes": {
                          "type": "string"
                        },
                        "briefing": {
                          "type": "object",
                          "properties": {
                            "as_of": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "current": {
                              "type": "object",
                              "properties": {
                                "profile": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "format": "uuid",
                                      "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                    },
                                    "name": {
                                      "type": "string",
                                      "description": "Chosen coaching/display name, used verbatim. Target UI prompt: What should we call you? Empty means unknown; no separate surname."
                                    },
                                    "about_me": {
                                      "type": "string",
                                      "description": "UI label: About me."
                                    },
                                    "timezone": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "UI label: Time zone. IANA zone used for calendar dates and boundaries."
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "name",
                                    "about_me",
                                    "timezone"
                                  ],
                                  "additionalProperties": false
                                },
                                "boundary": {
                                  "type": "object",
                                  "properties": {
                                    "at": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "session_id": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "format": "uuid",
                                          "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "source": {
                                      "enum": [
                                        "session",
                                        "cycle_start",
                                        "none"
                                      ],
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "at",
                                    "session_id",
                                    "source"
                                  ],
                                  "additionalProperties": false
                                },
                                "cycle_line": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "range": {
                                          "type": "string"
                                        },
                                        "time_gone_pct": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 100
                                        }
                                      },
                                      "required": [
                                        "range",
                                        "time_gone_pct"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "cycles": {
                                  "type": "object",
                                  "properties": {
                                    "items": {
                                      "type": "array",
                                      "maxItems": 50,
                                      "items": {
                                        "$ref": "#/components/schemas/Cycle"
                                      }
                                    },
                                    "next_cursor": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "items",
                                    "next_cursor"
                                  ],
                                  "additionalProperties": false
                                },
                                "cycle": {
                                  "anyOf": [
                                    {
                                      "$ref": "#/components/schemas/Cycle"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "objectives": {
                                  "type": "object",
                                  "properties": {
                                    "items": {
                                      "type": "array",
                                      "maxItems": 50,
                                      "items": {
                                        "$ref": "#/components/schemas/Objective"
                                      }
                                    },
                                    "next_cursor": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "items",
                                    "next_cursor"
                                  ],
                                  "additionalProperties": false
                                },
                                "results": {
                                  "type": "object",
                                  "properties": {
                                    "items": {
                                      "type": "array",
                                      "maxItems": 50,
                                      "items": {
                                        "$ref": "#/components/schemas/Result"
                                      }
                                    },
                                    "next_cursor": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "items",
                                    "next_cursor"
                                  ],
                                  "additionalProperties": false
                                },
                                "actions": {
                                  "type": "object",
                                  "properties": {
                                    "items": {
                                      "type": "array",
                                      "maxItems": 50,
                                      "items": {
                                        "$ref": "#/components/schemas/Action"
                                      }
                                    },
                                    "next_cursor": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "items",
                                    "next_cursor"
                                  ],
                                  "additionalProperties": false
                                },
                                "notes": {
                                  "type": "object",
                                  "properties": {
                                    "notes": {
                                      "type": "object",
                                      "properties": {
                                        "items": {
                                          "type": "array",
                                          "maxItems": 50,
                                          "items": {
                                            "$ref": "#/components/schemas/Note"
                                          }
                                        },
                                        "next_cursor": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      },
                                      "required": [
                                        "items",
                                        "next_cursor"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "selection": {
                                      "enum": [
                                        "since_boundary",
                                        "recent_fallback",
                                        "selected",
                                        "history"
                                      ],
                                      "type": "string"
                                    },
                                    "total": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "notes",
                                    "selection",
                                    "total"
                                  ],
                                  "additionalProperties": false
                                },
                                "last_completed_session": {
                                  "anyOf": [
                                    {
                                      "$ref": "#/components/schemas/Session"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "selected": {
                                  "type": "object",
                                  "properties": {
                                    "objective": {
                                      "anyOf": [
                                        {
                                          "$ref": "#/components/schemas/Objective"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "result": {
                                      "anyOf": [
                                        {
                                          "$ref": "#/components/schemas/Result"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "action": {
                                      "anyOf": [
                                        {
                                          "$ref": "#/components/schemas/Action"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "note": {
                                      "anyOf": [
                                        {
                                          "$ref": "#/components/schemas/Note"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "session": {
                                      "anyOf": [
                                        {
                                          "$ref": "#/components/schemas/Session"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "objective",
                                    "result",
                                    "action",
                                    "note",
                                    "session"
                                  ],
                                  "additionalProperties": false
                                },
                                "continuations": {
                                  "type": "object",
                                  "propertyNames": {
                                    "enum": [
                                      "cycles",
                                      "objectives",
                                      "results",
                                      "actions",
                                      "notes",
                                      "sessions",
                                      "result_logs",
                                      "habit_logs",
                                      "action_logs",
                                      "trend"
                                    ],
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                }
                              },
                              "required": [
                                "profile",
                                "boundary",
                                "cycle_line",
                                "cycles",
                                "cycle",
                                "objectives",
                                "results",
                                "actions",
                                "notes",
                                "last_completed_session",
                                "selected",
                                "continuations"
                              ],
                              "additionalProperties": false
                            },
                            "progress_by_type": {
                              "type": "object",
                              "properties": {
                                "objectives": {
                                  "type": "object",
                                  "properties": {
                                    "on_track": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "off_track": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "completed": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "on_track",
                                    "off_track",
                                    "completed"
                                  ],
                                  "additionalProperties": false
                                },
                                "results": {
                                  "type": "object",
                                  "properties": {
                                    "in_play": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "in_progress": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "completed": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "average_progress_pct": {
                                      "anyOf": [
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "in_play",
                                    "in_progress",
                                    "completed",
                                    "average_progress_pct"
                                  ],
                                  "additionalProperties": false
                                },
                                "actions": {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "in_progress": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "done": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "overdue": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "in_progress",
                                    "done",
                                    "overdue"
                                  ],
                                  "additionalProperties": false
                                },
                                "notes": {
                                  "type": "object",
                                  "properties": {
                                    "total": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "since_boundary": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "total",
                                    "since_boundary"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "objectives",
                                "results",
                                "actions",
                                "notes"
                              ],
                              "additionalProperties": false
                            },
                            "session_history": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "array",
                                  "maxItems": 6,
                                  "items": {
                                    "$ref": "#/components/schemas/Session"
                                  }
                                },
                                "next_cursor": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "items",
                                "next_cursor"
                              ],
                              "additionalProperties": false
                            },
                            "attention": {
                              "type": "object",
                              "properties": {
                                "overdue_actions": {
                                  "type": "object",
                                  "properties": {
                                    "items": {
                                      "type": "array",
                                      "maxItems": 50,
                                      "items": {
                                        "$ref": "#/components/schemas/Action"
                                      }
                                    },
                                    "next_cursor": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "items",
                                    "next_cursor"
                                  ],
                                  "additionalProperties": false
                                },
                                "never_updated_results": {
                                  "type": "object",
                                  "properties": {
                                    "items": {
                                      "type": "array",
                                      "maxItems": 50,
                                      "items": {
                                        "$ref": "#/components/schemas/Result"
                                      }
                                    },
                                    "next_cursor": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "items",
                                    "next_cursor"
                                  ],
                                  "additionalProperties": false
                                },
                                "silent_results": {
                                  "type": "object",
                                  "properties": {
                                    "items": {
                                      "type": "array",
                                      "maxItems": 50,
                                      "items": {
                                        "$ref": "#/components/schemas/Result"
                                      }
                                    },
                                    "next_cursor": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "items",
                                    "next_cursor"
                                  ],
                                  "additionalProperties": false
                                },
                                "unmarked_habits": {
                                  "type": "object",
                                  "properties": {
                                    "items": {
                                      "type": "array",
                                      "maxItems": 50,
                                      "items": {
                                        "$ref": "#/components/schemas/Result"
                                      }
                                    },
                                    "next_cursor": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "items",
                                    "next_cursor"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "overdue_actions",
                                "never_updated_results",
                                "silent_results",
                                "unmarked_habits"
                              ],
                              "additionalProperties": false
                            },
                            "pace": {
                              "enum": [
                                "ahead",
                                "behind",
                                "level",
                                "nothing_measurable"
                              ],
                              "type": "string"
                            },
                            "next_due_action": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Action"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "as_of",
                            "current",
                            "progress_by_type",
                            "session_history",
                            "attention",
                            "pace",
                            "next_due_action"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "access_state",
                        "session",
                        "briefing_notes",
                        "briefing"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "access_state": {
                          "const": "unpaid"
                        },
                        "enablement": {
                          "type": "object",
                          "properties": {
                            "instruction": {
                              "type": "string"
                            },
                            "signup_url": {
                              "type": "string",
                              "format": "uri"
                            }
                          },
                          "required": [
                            "instruction",
                            "signup_url"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "access_state",
                        "enablement"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "session-start"
      }
    },
    "/sessions/list": {
      "post": {
        "operationId": "sessions.list",
        "summary": "List coaching sessions",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "window": {
                    "type": "object",
                    "properties": {
                      "since": {
                        "anyOf": [
                          {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                              },
                              {
                                "type": "string",
                                "format": "date-time"
                              }
                            ]
                          },
                          {
                            "enum": [
                              "last_session",
                              "cycle_start"
                            ],
                            "type": "string"
                          }
                        ],
                        "description": "Inclusive lower bound. Default: last completed session, falling back to active-cycle start. Date-only values use the profile timezone."
                      },
                      "until": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                          },
                          {
                            "type": "string",
                            "format": "date-time"
                          }
                        ],
                        "description": "Exclusive upper bound; default is the server time captured on the first page."
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/Session"
                      }
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/sessions/get": {
      "post": {
        "operationId": "sessions.get",
        "summary": "Read coaching session details",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session": {
                      "$ref": "#/components/schemas/Session"
                    },
                    "actions": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "maxItems": 100,
                          "items": {
                            "$ref": "#/components/schemas/Action"
                          }
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "next_cursor"
                      ],
                      "additionalProperties": false
                    },
                    "continuations": {
                      "type": "object",
                      "propertyNames": {
                        "enum": [
                          "cycles",
                          "objectives",
                          "results",
                          "actions",
                          "notes",
                          "sessions",
                          "result_logs",
                          "habit_logs",
                          "action_logs",
                          "trend"
                        ],
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "required": [
                    "session",
                    "actions",
                    "continuations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    },
    "/sessions/close": {
      "post": {
        "operationId": "sessions.close",
        "summary": "Close coaching session and save summary",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `entitled-write`. Identity is resolved server-side.\n\nSave the session summary and end time. Moving the session boundary affects subsequent reads on both surfaces.",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                  },
                  "type": {
                    "enum": [
                      "goal_setup",
                      "check_in",
                      "review",
                      "open_coaching"
                    ],
                    "type": "string",
                    "description": "Coaching session type: Goal setup, Check-in, Review or Open coaching. Separate from whether the session is still open."
                  },
                  "headline": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "summary_notes": {
                    "type": "string",
                    "minLength": 1,
                    "description": "UI document: Summary. Saved when closing the coaching session."
                  }
                },
                "required": [
                  "session_id",
                  "type",
                  "headline",
                  "summary_notes"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session": {
                      "$ref": "#/components/schemas/Session"
                    },
                    "boundary_moved_to": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "session",
                    "boundary_moved_to"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "entitled-write"
      }
    },
    "/record/query": {
      "post": {
        "operationId": "record.query",
        "summary": "Read coaching context and history",
        "description": "**Contract only — service pending**\n\n**Access:** authenticated session; policy `retained-read`. Identity is resolved server-side.\n\nRead application context without session effects. History kinds require a window; explicit window bounds must increase. Date-only bounds resolve in the profile timezone. This generic reader is not an MCP tool.",
        "tags": [
          "Record"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filters": {
                    "type": "object",
                    "properties": {
                      "cycle_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "objective_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "result_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "action_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "note_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "session_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                      },
                      "kinds": {
                        "type": "array",
                        "minItems": 1,
                        "items": {
                          "enum": [
                            "result_logs",
                            "habit_logs",
                            "action_logs",
                            "notes",
                            "sessions"
                          ],
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "window": {
                    "type": "object",
                    "properties": {
                      "since": {
                        "anyOf": [
                          {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                              },
                              {
                                "type": "string",
                                "format": "date-time"
                              }
                            ]
                          },
                          {
                            "enum": [
                              "last_session",
                              "cycle_start"
                            ],
                            "type": "string"
                          }
                        ]
                      },
                      "until": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "description": "Calendar date as YYYY-MM-DD in the profile timezone."
                          },
                          {
                            "type": "string",
                            "format": "date-time"
                          }
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "continuations": {
                    "type": "object",
                    "properties": {
                      "cycles": {
                        "type": "string",
                        "minLength": 1
                      },
                      "objectives": {
                        "type": "string",
                        "minLength": 1
                      },
                      "results": {
                        "type": "string",
                        "minLength": 1
                      },
                      "actions": {
                        "type": "string",
                        "minLength": 1
                      },
                      "notes": {
                        "type": "string",
                        "minLength": 1
                      },
                      "sessions": {
                        "type": "string",
                        "minLength": 1
                      },
                      "result_logs": {
                        "type": "string",
                        "minLength": 1
                      },
                      "habit_logs": {
                        "type": "string",
                        "minLength": 1
                      },
                      "action_logs": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "current": {
                      "type": "object",
                      "properties": {
                        "profile": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                            },
                            "name": {
                              "type": "string",
                              "description": "Chosen coaching/display name, used verbatim. Target UI prompt: What should we call you? Empty means unknown; no separate surname."
                            },
                            "about_me": {
                              "type": "string",
                              "description": "UI label: About me."
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1,
                              "description": "UI label: Time zone. IANA zone used for calendar dates and boundaries."
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "about_me",
                            "timezone"
                          ],
                          "additionalProperties": false
                        },
                        "boundary": {
                          "type": "object",
                          "properties": {
                            "at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "session_id": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "uuid",
                                  "description": "Owned record UUID from fresh tool results or user-selected context. Never invent an ID; clarify ambiguous targets."
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "source": {
                              "enum": [
                                "session",
                                "cycle_start",
                                "none"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "at",
                            "session_id",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        "cycle_line": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "range": {
                                  "type": "string"
                                },
                                "time_gone_pct": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 100
                                }
                              },
                              "required": [
                                "range",
                                "time_gone_pct"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "cycles": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Cycle"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "cycle": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Cycle"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "objectives": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Objective"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "results": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Result"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "actions": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Action"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "notes": {
                          "type": "object",
                          "properties": {
                            "notes": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "$ref": "#/components/schemas/Note"
                                  }
                                },
                                "next_cursor": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "items",
                                "next_cursor"
                              ],
                              "additionalProperties": false
                            },
                            "selection": {
                              "enum": [
                                "since_boundary",
                                "recent_fallback",
                                "selected",
                                "history"
                              ],
                              "type": "string"
                            },
                            "total": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "notes",
                            "selection",
                            "total"
                          ],
                          "additionalProperties": false
                        },
                        "last_completed_session": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Session"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "selected": {
                          "type": "object",
                          "properties": {
                            "objective": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Objective"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "result": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Result"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "action": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Action"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "note": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Note"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "session": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Session"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "objective",
                            "result",
                            "action",
                            "note",
                            "session"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "profile",
                        "boundary",
                        "cycle_line",
                        "cycles",
                        "cycle",
                        "objectives",
                        "results",
                        "actions",
                        "notes",
                        "last_completed_session",
                        "selected",
                        "continuations"
                      ],
                      "additionalProperties": false
                    },
                    "history": {
                      "type": "object",
                      "properties": {
                        "window": {
                          "type": "object",
                          "properties": {
                            "since": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "until": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "since",
                            "until"
                          ],
                          "additionalProperties": false
                        },
                        "result_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/ResultLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "habit_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/HabitLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "action_logs": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/ActionLog"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "notes": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Note"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "sessions": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "$ref": "#/components/schemas/Session"
                              }
                            },
                            "next_cursor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "items",
                            "next_cursor"
                          ],
                          "additionalProperties": false
                        },
                        "continuations": {
                          "type": "object",
                          "propertyNames": {
                            "enum": [
                              "cycles",
                              "objectives",
                              "results",
                              "actions",
                              "notes",
                              "sessions",
                              "result_logs",
                              "habit_logs",
                              "action_logs",
                              "trend"
                            ],
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "window",
                        "result_logs",
                        "habit_logs",
                        "action_logs",
                        "notes",
                        "sessions",
                        "continuations"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "as_of",
                    "current"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "BAD_REQUEST"
                        },
                        "status": {
                          "const": 400
                        },
                        "message": {
                          "type": "string",
                          "default": "Bad Request"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "error_code": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_applied",
                                    "unknown"
                                  ],
                                  "type": "string"
                                },
                                "constraint": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "table": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "error_code"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "issues": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "message": {
                                        "type": "string"
                                      },
                                      "path": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                }
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string"
                                                    },
                                                    {
                                                      "type": "number"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "message"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "issues"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "UNAUTHORIZED"
                        },
                        "status": {
                          "const": 401
                        },
                        "message": {
                          "type": "string",
                          "default": "Unauthorized"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "FORBIDDEN"
                        },
                        "status": {
                          "const": 403
                        },
                        "message": {
                          "type": "string",
                          "default": "Forbidden"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_FOUND"
                        },
                        "status": {
                          "const": 404
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Found"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "409",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "CONFLICT"
                        },
                        "status": {
                          "const": 409
                        },
                        "message": {
                          "type": "string",
                          "default": "Conflict"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "429",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "TOO_MANY_REQUESTS"
                        },
                        "status": {
                          "const": 429
                        },
                        "message": {
                          "type": "string",
                          "default": "Too Many Requests"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "INTERNAL_SERVER_ERROR"
                        },
                        "status": {
                          "const": 500
                        },
                        "message": {
                          "type": "string",
                          "default": "Internal Server Error"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "type": "string"
                            },
                            "outcome": {
                              "enum": [
                                "not_applied",
                                "unknown"
                              ],
                              "type": "string"
                            },
                            "constraint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "table": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": true
                        },
                        "code": {
                          "const": "NOT_IMPLEMENTED"
                        },
                        "status": {
                          "const": 501
                        },
                        "message": {
                          "type": "string",
                          "default": "Not Implemented"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "error_code": {
                              "const": "NOT_IMPLEMENTED"
                            }
                          },
                          "required": [
                            "error_code"
                          ]
                        }
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "defined": {
                          "const": false
                        },
                        "code": {
                          "type": "string"
                        },
                        "status": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        },
                        "data": {}
                      },
                      "required": [
                        "defined",
                        "code",
                        "status",
                        "message"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "x-implementation": "contract-only",
        "x-access-policy": "retained-read"
      }
    }
  }
}
