Skip to content
CodeAncestry

Documentation · Reference

Live schemas

JSON Schema Draft 2020-12, compiled at request time from the Zod modules in lib/schema. The examples are abridged seeded records — field names match the schema, values match the fixtures.

Draft and origin

Dialect: https://json-schema.org/draft/2020-12/schema. Generator: z.toJSONSchema from Zod 4. Fixture $schema URLs resolve to the same documents served at /schemas/<name>/v0.1.json.

Phenotype has a schema and no seeded CAPHENO records. Export reconstructs phenotype lines from sandbox runs; this viewer therefore has no phenotype example.

Published JSON Schema documents
RecordURLWhat it validates
genome.json/schemas/genome/v0.1.jsonVersioned composition of a project: genes, parents, source, privacy.
gene.json/schemas/gene/v0.1.jsonA stable semantic capability and the alleles that implement it.
allele/schemas/allele/v0.1.jsonOne implementation of a gene. Embedded in gene.json, addressable alone.
mutation.json/schemas/mutation/v0.1.jsonA typed change with evidence, fitness vector and adoption state.
agent-dna.json/schemas/agent-dna/v0.1.jsonPortable, consented agent identity. Never weights or private reasoning.
lineage edge/schemas/lineage-edge/v0.1.jsonA typed, evidence-bearing relation on the lineage DAG.
evidence/schemas/evidence/v0.1.jsonA single reason to believe a claim, with a GO-style code.
phenotype/schemas/phenotype/v0.1.jsonMeasured behaviour of a genome in a stated environment.
features.jsonl/schemas/feature/v0.1.jsonGFF-inspired locus records mapping source ranges onto genes.

Viewer

/schemas/genome/v0.1.json

Versioned composition of a project: genes, parents, source, privacy. JSON Schema Draft 2020-12, generated with z.toJSONSchema from the live Zod module.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri"
    },
    "schemaVersion": {
      "type": "string",
      "const": "0.1"
    },
    "id": {
      "type": "string"
    },
    "project": {
      "type": "string"
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "slug": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$"
    },
    "tagline": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string",
      "minLength": 1
    },
    "generation": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "visibility": {
      "type": "string",
      "enum": [
        "public",
        "organization",
        "private"
      ]
    },
    "createdAt": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "source": {
      "type": "object",
      "properties": {
        "provider": {
          "type": "string",
          "enum": [
            "github",
            "gitlab",
            "bitbucket",
            "local"
          ]
        },
        "repository": {
          "type": "string",
          "minLength": 1
        },
        "commit": {
          "type": "string",
          "pattern": "^[0-9a-f]{7,40}$"
        },
        "treeDigest": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{6,64}$"
        },
        "defaultBranch": {
          "default": "main",
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "provider",
        "repository",
        "commit",
        "treeDigest",
        "defaultBranch"
      ],
      "additionalProperties": false
    },
    "parents": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "project": {
            "type": "string"
          },
          "genome": {
            "type": "string"
          },
          "relationship": {
            "type": "string",
            "enum": [
              "child",
              "remix",
              "cover",
              "hybrid"
            ]
          },
          "bornFromCommit": {
            "type": "string",
            "pattern": "^[0-9a-f]{7,40}$"
          },
          "contribution": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "project",
          "genome",
          "relationship",
          "bornFromCommit",
          "contribution"
        ],
        "additionalProperties": false
      }
    },
    "genes": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "gene": {
            "type": "string"
          },
          "allele": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "minLength": 1
          },
          "digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{6,64}$"
          },
          "expression": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "conditional"
            ]
          },
          "inheritance": {
            "type": "string",
            "enum": [
              "native",
              "inherited",
              "mutated",
              "local",
              "transferred"
            ]
          },
          "origin": {
            "type": "string"
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "evidence": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "anchors": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "repository": {
                  "type": "string",
                  "minLength": 1
                },
                "commit": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{7,40}$"
                },
                "path": {
                  "type": "string",
                  "minLength": 1
                },
                "symbols": {
                  "default": [],
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "range": {
                  "type": "array",
                  "prefixItems": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  ]
                }
              },
              "required": [
                "repository",
                "commit",
                "path",
                "symbols"
              ],
              "additionalProperties": false
            }
          },
          "weight": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "gene",
          "allele",
          "version",
          "digest",
          "expression",
          "inheritance",
          "confidence",
          "evidence",
          "anchors",
          "weight"
        ],
        "additionalProperties": false
      }
    },
    "agents": {
      "default": [],
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "releases": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "minLength": 1
          },
          "date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "commit": {
            "type": "string",
            "pattern": "^[0-9a-f]{7,40}$"
          },
          "verified": {
            "type": "boolean"
          }
        },
        "required": [
          "version",
          "date",
          "commit",
          "verified"
        ],
        "additionalProperties": false
      }
    },
    "dependencies": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "string",
            "minLength": 1
          },
          "ecosystem": {
            "type": "string",
            "enum": [
              "npm",
              "pypi",
              "cargo",
              "maven",
              "oci",
              "go"
            ]
          },
          "license": {
            "type": "string",
            "minLength": 1
          },
          "introducedAt": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "advisory": {
            "default": "none",
            "type": "string",
            "enum": [
              "none",
              "open",
              "resolved"
            ]
          }
        },
        "required": [
          "name",
          "version",
          "ecosystem",
          "license",
          "introducedAt",
          "advisory"
        ],
        "additionalProperties": false
      }
    },
    "security": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "summary": {
            "type": "string",
            "minLength": 1
          },
          "severity": {
            "type": "string",
            "enum": [
              "low",
              "moderate",
              "high",
              "critical"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "raisedAt": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "resolvedAt": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "id",
          "summary",
          "severity",
          "status",
          "raisedAt"
        ],
        "additionalProperties": false
      }
    },
    "agentActivity": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "agent": {
            "type": "string"
          },
          "at": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "action": {
            "type": "string",
            "enum": [
              "analyze",
              "edit",
              "test",
              "propose",
              "review"
            ]
          },
          "summary": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "agent",
          "at",
          "action",
          "summary"
        ],
        "additionalProperties": false
      }
    },
    "tests": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "at": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "passed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "coverage": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "at",
          "passed",
          "total",
          "coverage"
        ],
        "additionalProperties": false
      }
    },
    "attestations": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "slsa-provenance",
              "in-toto-test-result",
              "cyclonedx-pedigree",
              "spdx-document",
              "github-artifact-attestation"
            ]
          },
          "predicateType": {
            "type": "string",
            "minLength": 1
          },
          "subjectDigest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{6,64}$"
          },
          "issuer": {
            "type": "string",
            "minLength": 1
          },
          "issuedAt": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "verified": {
            "type": "boolean"
          }
        },
        "required": [
          "type",
          "predicateType",
          "subjectDigest",
          "issuer",
          "issuedAt",
          "verified"
        ],
        "additionalProperties": false
      }
    },
    "licenses": {
      "type": "object",
      "properties": {
        "spdxExpression": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "spdxExpression"
      ],
      "additionalProperties": false
    },
    "lineageAssurance": {
      "type": "string",
      "enum": [
        "inferred",
        "reviewed",
        "verified"
      ]
    },
    "privacy": {
      "type": "object",
      "properties": {
        "registryVisibility": {
          "type": "string",
          "enum": [
            "public",
            "organization",
            "private"
          ]
        },
        "sourceVisibility": {
          "type": "string",
          "enum": [
            "inherit-provider",
            "metadata-only",
            "hidden"
          ]
        },
        "agentTelemetry": {
          "type": "string",
          "enum": [
            "none",
            "metadata-only",
            "tool-io",
            "excerpts",
            "full"
          ]
        }
      },
      "required": [
        "registryVisibility",
        "sourceVisibility",
        "agentTelemetry"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schemaVersion",
    "id",
    "project",
    "name",
    "slug",
    "tagline",
    "description",
    "generation",
    "visibility",
    "createdAt",
    "source",
    "parents",
    "genes",
    "agents",
    "releases",
    "dependencies",
    "security",
    "agentActivity",
    "tests",
    "attestations",
    "licenses",
    "lineageAssurance",
    "privacy"
  ],
  "additionalProperties": false,
  "$id": "https://codeancestry.com/schemas/genome/v0.1.json",
  "title": "genome.json",
  "description": "Versioned composition of a project: genes, parents, source, privacy."
}