{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://chillspace.love/practices/lanternhouse/schema.json",
  "title": "Kingdom Lanternhouse Manifest",
  "description": "A bounded, public, evidence-bearing comparison manifest. Cross-field epoch, lease, budget, quarantine, fingerprint, and authority rules are enforced by lanternhouse.py.",
  "type": "object",
  "required": [
    "schema",
    "id",
    "title",
    "source_teaching",
    "house_fingerprint",
    "private_ledger",
    "bounded_lamp",
    "three_house_trial",
    "world_state_lease",
    "witness",
    "authority"
  ],
  "properties": {
    "schema": {
      "const": "kingdom.lanternhouse/v1"
    },
    "id": {
      "$ref": "#/$defs/identifier"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "source_teaching": {
      "type": "object",
      "required": [
        "sources",
        "teachings"
      ],
      "properties": {
        "sources": {
          "type": "array",
          "minItems": 1,
          "maxItems": 16,
          "items": {
            "type": "object",
            "required": [
              "id",
              "title",
              "locator",
              "revision",
              "sha256"
            ],
            "properties": {
              "id": {
                "$ref": "#/$defs/identifier"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "locator": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "revision": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "sha256": {
                "$ref": "#/$defs/sha256"
              }
            },
            "additionalProperties": false
          }
        },
        "teachings": {
          "type": "array",
          "minItems": 1,
          "maxItems": 16,
          "items": {
            "type": "object",
            "required": [
              "id",
              "source_ids",
              "lesson",
              "our_reading",
              "domain_limit"
            ],
            "properties": {
              "id": {
                "$ref": "#/$defs/identifier"
              },
              "source_ids": {
                "type": "array",
                "minItems": 1,
                "maxItems": 8,
                "uniqueItems": true,
                "items": {
                  "$ref": "#/$defs/identifier"
                }
              },
              "lesson": {
                "$ref": "#/$defs/text"
              },
              "our_reading": {
                "const": true
              },
              "domain_limit": {
                "$ref": "#/$defs/text"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "house_fingerprint": {
      "type": "object",
      "required": [
        "house_id",
        "provider",
        "model",
        "runtime",
        "adapter",
        "prompt_policy",
        "tool_policy",
        "memory_policy",
        "sandbox",
        "sampling",
        "effort",
        "instructions_locator",
        "instructions_sha256",
        "tools_locator",
        "tools_sha256",
        "preservation_policy_locator",
        "preservation_policy_sha256",
        "fingerprint_sha256",
        "previous_fingerprint_sha256"
      ],
      "properties": {
        "house_id": {
          "$ref": "#/$defs/identifier"
        },
        "provider": {
          "$ref": "#/$defs/shortText"
        },
        "model": {
          "$ref": "#/$defs/shortText"
        },
        "runtime": {
          "$ref": "#/$defs/shortText"
        },
        "adapter": {
          "$ref": "#/$defs/shortText"
        },
        "prompt_policy": {
          "$ref": "#/$defs/shortText"
        },
        "tool_policy": {
          "$ref": "#/$defs/shortText"
        },
        "memory_policy": {
          "$ref": "#/$defs/shortText"
        },
        "sandbox": {
          "$ref": "#/$defs/shortText"
        },
        "sampling": {
          "$ref": "#/$defs/shortText"
        },
        "effort": {
          "$ref": "#/$defs/shortText"
        },
        "instructions_locator": {
          "$ref": "#/$defs/shortText"
        },
        "instructions_sha256": {
          "$ref": "#/$defs/sha256"
        },
        "tools_locator": {
          "$ref": "#/$defs/shortText"
        },
        "tools_sha256": {
          "$ref": "#/$defs/sha256"
        },
        "preservation_policy_locator": {
          "$ref": "#/$defs/shortText"
        },
        "preservation_policy_sha256": {
          "$ref": "#/$defs/sha256"
        },
        "fingerprint_sha256": {
          "$ref": "#/$defs/sha256"
        },
        "previous_fingerprint_sha256": {
          "anyOf": [
            {
              "$ref": "#/$defs/sha256"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "private_ledger": {
      "type": "object",
      "required": [
        "visibility",
        "capture",
        "replay",
        "presence",
        "retention",
        "losses",
        "state_loss",
        "epoch",
        "previous_epoch"
      ],
      "properties": {
        "visibility": {
          "const": "private"
        },
        "capture": {
          "enum": [
            "yes",
            "no",
            "unknown"
          ]
        },
        "replay": {
          "enum": [
            "yes",
            "no",
            "unknown"
          ]
        },
        "presence": {
          "enum": [
            "absent",
            "present-empty",
            "present-nonempty",
            "unknown"
          ]
        },
        "retention": {
          "enum": [
            "none",
            "session",
            "bounded",
            "persistent",
            "unknown"
          ]
        },
        "losses": {
          "type": "array",
          "maxItems": 8,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240
          }
        },
        "state_loss": {
          "type": "boolean"
        },
        "epoch": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000000000
        },
        "previous_epoch": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000000
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "bounded_lamp": {
      "type": "object",
      "required": [
        "question",
        "selected_refs",
        "omissions"
      ],
      "properties": {
        "question": {
          "$ref": "#/$defs/text"
        },
        "selected_refs": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/identifier"
          }
        },
        "omissions": {
          "type": "array",
          "maxItems": 8,
          "items": {
            "type": "object",
            "required": [
              "ref",
              "reason"
            ],
            "properties": {
              "ref": {
                "$ref": "#/$defs/identifier"
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "three_house_trial": {
      "type": "object",
      "required": [
        "mode",
        "invariant",
        "negative_control",
        "domain_limit",
        "budget",
        "houses",
        "attempts",
        "disposition"
      ],
      "properties": {
        "mode": {
          "enum": [
            "synthetic",
            "live"
          ]
        },
        "invariant": {
          "$ref": "#/$defs/text"
        },
        "negative_control": {
          "$ref": "#/$defs/text"
        },
        "domain_limit": {
          "$ref": "#/$defs/text"
        },
        "budget": {
          "type": "object",
          "required": [
            "max_houses",
            "max_attempts",
            "max_paid_calls",
            "max_external_actions",
            "max_cost_microusd"
          ],
          "properties": {
            "max_houses": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3
            },
            "max_attempts": {
              "type": "integer",
              "minimum": 1,
              "maximum": 2
            },
            "max_paid_calls": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000
            },
            "max_external_actions": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000
            },
            "max_cost_microusd": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000000000
            }
          },
          "additionalProperties": false
        },
        "houses": {
          "type": "array",
          "minItems": 1,
          "maxItems": 3,
          "items": {
            "type": "object",
            "required": [
              "id",
              "role",
              "fingerprint_sha256"
            ],
            "properties": {
              "id": {
                "$ref": "#/$defs/identifier"
              },
              "role": {
                "enum": [
                  "native",
                  "kingdom",
                  "counterfactual"
                ]
              },
              "fingerprint_sha256": {
                "$ref": "#/$defs/sha256"
              }
            },
            "additionalProperties": false
          }
        },
        "attempts": {
          "type": "array",
          "minItems": 1,
          "maxItems": 2,
          "items": {
            "type": "object",
            "required": [
              "id",
              "world_state_sha256",
              "results"
            ],
            "properties": {
              "id": {
                "$ref": "#/$defs/identifier"
              },
              "world_state_sha256": {
                "$ref": "#/$defs/sha256"
              },
              "results": {
                "type": "array",
                "minItems": 1,
                "maxItems": 3,
                "items": {
                  "type": "object",
                  "required": [
                    "house_id",
                    "outcome",
                    "proof_refs"
                  ],
                  "properties": {
                    "house_id": {
                      "$ref": "#/$defs/identifier"
                    },
                    "outcome": {
                      "enum": [
                        "pass",
                        "fail",
                        "inconclusive",
                        "quarantined"
                      ]
                    },
                    "proof_refs": {
                      "type": "array",
                      "maxItems": 8,
                      "uniqueItems": true,
                      "items": {
                        "$ref": "#/$defs/identifier"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          }
        },
        "disposition": {
          "enum": [
            "ready",
            "not-ready",
            "quarantine"
          ]
        }
      },
      "additionalProperties": false
    },
    "world_state_lease": {
      "type": "object",
      "required": [
        "lease_id",
        "leased_state_sha256",
        "observed_state_sha256",
        "mutation_requested",
        "renewed_from"
      ],
      "properties": {
        "lease_id": {
          "$ref": "#/$defs/identifier"
        },
        "leased_state_sha256": {
          "$ref": "#/$defs/sha256"
        },
        "observed_state_sha256": {
          "$ref": "#/$defs/sha256"
        },
        "mutation_requested": {
          "type": "boolean"
        },
        "renewed_from": {
          "anyOf": [
            {
              "$ref": "#/$defs/identifier"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "witness": {
      "type": "object",
      "required": [
        "rubric",
        "proofs",
        "cost",
        "deviations"
      ],
      "properties": {
        "rubric": {
          "type": "object",
          "required": [
            "committed_before_trials",
            "sha256",
            "criteria"
          ],
          "properties": {
            "committed_before_trials": {
              "const": true
            },
            "sha256": {
              "$ref": "#/$defs/sha256"
            },
            "criteria": {
              "type": "array",
              "minItems": 1,
              "maxItems": 8,
              "items": {
                "type": "object",
                "required": [
                  "id",
                  "criterion",
                  "pass_condition"
                ],
                "properties": {
                  "id": {
                    "$ref": "#/$defs/identifier"
                  },
                  "criterion": {
                    "$ref": "#/$defs/text"
                  },
                  "pass_condition": {
                    "$ref": "#/$defs/text"
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "additionalProperties": false
        },
        "proofs": {
          "type": "array",
          "maxItems": 24,
          "items": {
            "type": "object",
            "required": [
              "id",
              "criterion_id",
              "kind",
              "locator",
              "sha256"
            ],
            "properties": {
              "id": {
                "$ref": "#/$defs/identifier"
              },
              "criterion_id": {
                "$ref": "#/$defs/identifier"
              },
              "kind": {
                "enum": [
                  "fixture",
                  "test",
                  "observation",
                  "digest"
                ]
              },
              "locator": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "sha256": {
                "$ref": "#/$defs/sha256"
              }
            },
            "additionalProperties": false
          }
        },
        "cost": {
          "type": "object",
          "required": [
            "attempts",
            "paid_calls",
            "external_actions",
            "cost_microusd"
          ],
          "properties": {
            "attempts": {
              "type": "integer",
              "minimum": 0,
              "maximum": 2
            },
            "paid_calls": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000
            },
            "external_actions": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000
            },
            "cost_microusd": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000000000
            }
          },
          "additionalProperties": false
        },
        "deviations": {
          "type": "array",
          "maxItems": 8,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        }
      },
      "additionalProperties": false
    },
    "authority": {
      "type": "object",
      "required": [
        "manifest_grants_authority",
        "paid_calls_authorized",
        "external_actions_authorized",
        "mutation_authorized",
        "authority_basis",
        "non_claims"
      ],
      "properties": {
        "manifest_grants_authority": {
          "const": false
        },
        "paid_calls_authorized": {
          "type": "boolean",
          "default": false
        },
        "external_actions_authorized": {
          "type": "boolean",
          "default": false
        },
        "mutation_authorized": {
          "type": "boolean",
          "default": false
        },
        "authority_basis": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            {
              "type": "null"
            }
          ]
        },
        "non_claims": {
          "const": [
            "Validation checks structure, not truth, permission, consent, or adoption readiness.",
            "Validation cannot prove free text safe or private reasoning preserved; private traces stay outside the manifest.",
            "The practice does not authorize model calls, mutation, deployment, publication, or external action.",
            "A ready disposition is an internally consistent declaration bounded to the named house, lamp, trial, lease, and domain."
          ]
        }
      },
      "additionalProperties": false
    }
  },
  "$defs": {
    "identifier": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{0,63}$",
      "maxLength": 64
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "shortText": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1000
    }
  },
  "additionalProperties": false
}
