{
  "rootib": "RootIB: RB-20260304173933-DS000001",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://barbrickdesign.github.io/deepsoil/schemas/idea.manifest.schema.json",
  "title": "DeepSoil Idea Manifest",
  "description": "Schema for rooted idea entries in the DeepSoil substrate. Every idea MUST reference a valid RootIB identity, carry lineage anchors, and include blessing metadata. RootIB is the authoritative identity and governance layer; DeepSoil stores and indexes the entry.",
  "type": "object",
  "required": [
    "idea_id",
    "name",
    "description",
    "tags",
    "parents",
    "children",
    "rootib",
    "rootib_lineage",
    "rootib_blessing",
    "deepsoil_meta"
  ],
  "properties": {
    "idea_id": {
      "type": "string",
      "description": "Stable, globally unique identifier for this idea. Convention: 'idea:<namespace>.<slug>'.",
      "pattern": "^idea:[a-z0-9._-]+$",
      "examples": ["idea:deepsoil.core-layer", "idea:rooted-summarization"]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the idea.",
      "minLength": 1,
      "maxLength": 256
    },
    "description": {
      "type": "string",
      "description": "Full description of what this idea represents.",
      "minLength": 1
    },
    "tags": {
      "type": "array",
      "description": "Semantic tags for discovery and categorisation.",
      "items": { "type": "string" },
      "minItems": 0
    },
    "parents": {
      "type": "array",
      "description": "idea_id values of parent ideas this idea derives from.",
      "items": {
        "type": "string",
        "pattern": "^idea:[a-z0-9._-]+$"
      }
    },
    "children": {
      "type": "array",
      "description": "idea_id values of child ideas that derive from this idea.",
      "items": {
        "type": "string",
        "pattern": "^idea:[a-z0-9._-]+$"
      }
    },
    "rootib": {
      "type": "string",
      "description": "RootIB identity string for this idea. Format: 'RootIB: <CreatorID>-<YYYYMMDDHHmmss>-<8HEX>'. This is the authoritative provenance anchor issued by the idea creator. Required for all DeepSoil entries.",
      "pattern": "^RootIB: [A-Za-z0-9_.-]{1,64}-\\d{14,17}-[0-9A-Fa-f]{8}$",
      "examples": ["RootIB: RB-20260223081500-9F3A7C21"]
    },
    "rootib_lineage": {
      "type": "object",
      "description": "RootIB lineage anchor. References the chain of provenance from genesis to this idea. Validated by RootIB; stored by DeepSoil.",
      "required": ["lineage_root"],
      "properties": {
        "lineage_root": {
          "type": "string",
          "description": "The RootIB identity at the root of this idea's lineage chain. Often the same as 'rootib' for genesis ideas.",
          "pattern": "^RootIB: [A-Za-z0-9_.-]{1,64}-\\d{14,17}-[0-9A-Fa-f]{8}$"
        },
        "parent_rootib": {
          "type": ["string", "null"],
          "description": "RootIB identity of the direct parent entry in the lineage chain. Null for root/genesis ideas.",
          "pattern": "^RootIB: [A-Za-z0-9_.-]{1,64}-\\d{14,17}-[0-9A-Fa-f]{8}$"
        },
        "parents": {
          "type": "array",
          "description": "Ordered list of parent RootIB identities, from genesis to direct parent.",
          "items": {
            "type": "string",
            "pattern": "^RootIB: [A-Za-z0-9_.-]{1,64}-\\d{14,17}-[0-9A-Fa-f]{8}$"
          }
        }
      },
      "additionalProperties": false
    },
    "rootib_blessing": {
      "type": "object",
      "description": "RootIB blessing metadata. Records who blessed this idea, when, and with what blessing keys. RootIB enforces blessing trees for tool and agent access. DeepSoil stores this metadata.",
      "required": ["blessed", "blessings"],
      "properties": {
        "blessed": {
          "type": "boolean",
          "description": "Whether this idea has received at least one active blessing."
        },
        "blessings": {
          "type": "array",
          "description": "Array of active blessing identifiers granted to this idea.",
          "items": { "type": "string" },
          "examples": [["blessing:deepsoil.core", "blessing:family.safety"]]
        },
        "blessed_by": {
          "type": "string",
          "description": "CreatorID of the RootIB identity that issued the blessing."
        },
        "blessed_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601 timestamp when the blessing was granted."
        },
        "revoked": {
          "type": "boolean",
          "description": "Whether all blessings have been revoked. Default: false.",
          "default": false
        }
      },
      "additionalProperties": false
    },
    "governance": {
      "type": "object",
      "description": "Governance metadata. All governance models must follow RootIB rules. DeepSoil stores this metadata; RootIB enforces it.",
      "properties": {
        "curators": {
          "type": "array",
          "description": "Solana pubkeys authorised to modify this idea entry.",
          "items": { "type": "string" }
        },
        "model": {
          "type": "string",
          "description": "Governance model.",
          "enum": ["single_owner", "multisig", "dao"]
        },
        "revocable": {
          "type": "boolean",
          "description": "Whether this idea can be revoked.",
          "default": true
        }
      }
    },
    "deepsoil_meta": {
      "type": "object",
      "description": "DeepSoil storage metadata. Describes how and where this entry lives in the DeepSoil substrate.",
      "required": ["program_id", "entry_type"],
      "properties": {
        "program_id": {
          "type": "string",
          "description": "Solana program ID of the DeepSoil program that owns this PDA.",
          "default": "DEEPSOiL111111111111111111111111111111111"
        },
        "entry_type": {
          "type": "string",
          "description": "Must be 'idea' for idea manifests.",
          "const": "idea"
        },
        "schema_version": {
          "type": "string",
          "description": "Version of this manifest schema.",
          "default": "1.0.0"
        },
        "network": {
          "type": "string",
          "description": "Solana network where this entry is anchored.",
          "enum": ["solana-mainnet", "solana-devnet", "solana-localnet", "solana-simulated"],
          "default": "solana-simulated"
        },
        "pda_seed": {
          "type": "string",
          "description": "Deterministic seed used to derive the Solana PDA for this idea."
        },
        "manifest_uri": {
          "type": "string",
          "description": "Arweave, IPFS, or HTTPS URI pointing to the full manifest JSON.",
          "format": "uri"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": true
}
