{
  "schema": "leumas.docs.page/1",
  "id": "pkg:@leumas/body",
  "slug": "packages/body",
  "kind": "capabilities",
  "bucket": "package",
  "title": "@leumas/body — the Universal Body Engine",
  "name": "@leumas/body",
  "eyebrow": "the Universal Body Engine",
  "chip": null,
  "summary": "The Universal Body Engine — the species-agnostic biological primitive: a typed anatomical graph, a species/variant registry, ontology source adapters (Uberon), fuzzy anatomical search...",
  "keywords": [
    "body",
    "pathfinding",
    "species-agnostic",
    "uberon",
    "physiology",
    "body api",
    "leumas body",
    "citable"
  ],
  "audience": "both",
  "funnel": {
    "product": null,
    "cta": null
  },
  "body": "# @leumas/body — the Universal Body Engine\n\nA new Leumas primitive: **BODY**. A species-agnostic anatomical graph, a species/variant registry,\nontology source adapters, anatomical search, typed traversal and pathfinding, a physiology layer, a\ndataset validation engine, and the provenance model that makes every fact citable.\n\nZero runtime dependencies. Pure isomorphic ESM — the same code answers `/api/body` on the server and\ndrives the viewer in the browser, so a rule cannot disagree with itself.\n\n```js\nimport { createSpeciesRegistry, loadBody, ask } from '@leumas/body';\nimport { installShippedSpecies } from '@leumas/body/data/species/index.js';\n\nconst registry = installShippedSpecies(createSpeciesRegistry());\nconst body = await loadBody({ registry, species: 'human', variant: 'adult-female' });\n\nbody.search('cranial nerve').results;          // canonical ids, with HOW each matched\nbody.describe('heart');                        // the full card, with sources\nbody.contains({ withinId: 'region:human:hand', category: 'bone' });   // 38 bones\nbody.trace({ from: 'heart right ventricle', to: 'left cardiac atrium' });\nask('What supplies the heart with blood?', body);   // facts + visual actions + citations\n```\n\n## The claim this package exists to make\n\n> **The 3D model is not the body.** The body is a graph; a mesh is one representation hung off a node\n> of it.\n\nEvery question above is answered with no geometry loaded. Almost every structure has no mesh and is\nfully usable.\n\n> **Most positions in this atlas were derived, not authored.** The human body plan places every bone,\n> every named joint, every muscle group, the viscera and the major vessels and nerves by hand; the\n> rest are put inside whatever the ontology says contains them. `check:body` prints the live split.\n> Every placement carries the tier it was arrived at and a sentence explaining it. Read\n> `docs/placement.md` before quoting a position anywhere.\n\n## Human is data, not code\n\nGrep `src/` for `human` and you find nothing. It appears in exactly two places: `data/species/human/*`\nand the list of shipped species. `data/species/test-organism/` — a synthetic twelve-structure creature\nwith three systems that are not human systems — is installed through the same registry and exercised\nby `test/cross-species.test.js`. That test is the alarm that goes off when the engine quietly learns\nwhat a heart is.\n\n## What ships\n\n| | |\n|---|---|\n| **human** | 12 systems · 13 regions · 2 variants (male, female) |\n| **dog** | 12 systems · 13 regions · 6 variants (three sizes × two sexes) |\n| **test-organism** | 3 systems · 2 regions · 2 variants — synthetic, and the reason the engine stays generic |\n| Sources | Uberon 2026-06-19 (CC BY 4.0) · OpenStax A&P 2e (CC BY 4.0) · Sisson *Veterinary Anatomy* 1910 (public domain) · Leumas curation |\n| Geometry | schematic primitives — see `data/licenses/manifest.json` for why, and what was NOT taken |\n\nStructure and relationship counts are not written here on purpose: they move on every ontology\nrefresh, and a number in prose is a number that goes stale silently. `pnpm check:body` prints the\nlive ones, and `ingest.report.json` per species records how that slice was selected.\n\n## The layout\n\n```\nsrc/\n  relations.js      the 64 closed relationship types, their inverses and their RO/BFO ids\n  schema/           the entity contracts + per-record validators + the id grammar\n  graph/            typed adjacency, traversal, pathfinding, sub-graphs\n  search/           fuzzy anatomical search over labels, synonyms and ontology aliases\n  registry/         species installation and variant resolution\n  query/            natural language → graph plan → structured facts + visual actions\n  validate/         the cross-record contract every shipped dataset passes\n  adapters/         the AnatomySourceAdapter seam + the Uberon OBOGraph adapter\n  serialize.js      the on-disk form (interned sources) and its round trip\n  load.js           the SDK\n  router.js         the express router factory (`@leumas/body/router`)\ndata/\n  species/<id>/     one folder per body — five generated files, three curated ones\n  licenses/         the machine-readable licence manifest\ndocs/               one file per \"how do I add a …\"\n```\n\n## Prove it\n\n```sh\npnpm --filter @leumas/body test    # 37 tests\npnpm check:body                    # the dataset, licences, lessons, manifests — and its own self-test\npnpm anatomy:validate              # every shipped species, as a report\n```\n\n## Read next\n\n`docs/README.md` for the developer guides · `.claude/skills/leumas-body/SKILL.md` for the agent's view.\n",
  "source": {
    "path": "shared/packages/body/README.md",
    "blobSha": "",
    "commit": "",
    "committedAt": "",
    "provenance": "no-git",
    "bytes": 4882,
    "hash": "7854c5c15a80963e3b9adc05158c1919b81a13c5"
  },
  "urls": {
    "html": "/p/packages/body",
    "json": "/docs/packages/body.json",
    "md": "/docs/packages/body.md"
  },
  "links": {
    "composes": [
      "pkg:@leumas/api-kit"
    ],
    "usedBy": [
      "pkg:@leumas/body-viewer",
      "pkg:@leumas/studio"
    ],
    "product": [
      "pkg:@leumas/studio"
    ],
    "howTo": [],
    "skills": [
      "skill:leumas-body"
    ]
  },
  "exports": {
    "total": 120,
    "component": 36,
    "hook": 0,
    "helper": 84,
    "names": [
      {
        "n": "ANATOMY_VOCABULARY",
        "k": "component"
      },
      {
        "n": "CATEGORIES",
        "k": "component"
      },
      {
        "n": "CATEGORIES",
        "k": "component"
      },
      {
        "n": "FLOW_RELATIONS",
        "k": "component"
      },
      {
        "n": "FLOW_RELATIONS",
        "k": "component"
      },
      {
        "n": "HIERARCHY_RELATIONS",
        "k": "component"
      },
      {
        "n": "HIERARCHY_RELATIONS",
        "k": "component"
      },
      {
        "n": "ID_CLASSES",
        "k": "component"
      },
      {
        "n": "ID_CLASSES",
        "k": "component"
      },
      {
        "n": "INTENTS",
        "k": "component"
      },
      {
        "n": "INTENTS",
        "k": "component"
      },
      {
        "n": "LATERALITIES",
        "k": "component"
      },
      {
        "n": "LATERALITIES",
        "k": "component"
      },
      {
        "n": "LESSON_STEP_KINDS",
        "k": "component"
      },
      {
        "n": "LESSON_STEP_KINDS",
        "k": "component"
      },
      {
        "n": "MODIFIER_TOKENS",
        "k": "component"
      },
      {
        "n": "PLACEMENT_TIERS",
        "k": "component"
      },
      {
        "n": "PLACEMENT_TIERS",
        "k": "component"
      },
      {
        "n": "RELATION_ALIASES",
        "k": "component"
      },
      {
        "n": "RELATION_CATEGORIES",
        "k": "component"
      },
      {
        "n": "RELATION_CATEGORIES",
        "k": "component"
      },
      {
        "n": "RELATION_IDS",
        "k": "component"
      },
      {
        "n": "RELATION_IDS",
        "k": "component"
      },
      {
        "n": "RELATION_TYPES",
        "k": "component"
      },
      {
        "n": "RELATION_TYPES",
        "k": "component"
      },
      {
        "n": "SCALES",
        "k": "component"
      },
      {
        "n": "SCALES",
        "k": "component"
      },
      {
        "n": "SEX_APPLICABILITY",
        "k": "component"
      },
      {
        "n": "SEX_APPLICABILITY",
        "k": "component"
      },
      {
        "n": "SHIPPED_SPECIES",
        "k": "component"
      },
      {
        "n": "STOP_TOKENS",
        "k": "component"
      },
      {
        "n": "TAXONOMY_RELATIONS",
        "k": "component"
      },
      {
        "n": "TAXONOMY_RELATIONS",
        "k": "component"
      },
      {
        "n": "TREE_RELATIONS",
        "k": "component"
      },
      {
        "n": "TREE_RELATIONS",
        "k": "component"
      },
      {
        "n": "VISUAL_ACTIONS",
        "k": "component"
      },
      {
        "n": "ask",
        "k": "helper"
      },
      {
        "n": "ask",
        "k": "helper"
      },
      {
        "n": "atDetail",
        "k": "helper"
      },
      {
        "n": "atDetail",
        "k": "helper"
      },
      {
        "n": "compact",
        "k": "helper"
      },
      {
        "n": "createAdapterRegistry",
        "k": "helper"
      },
      {
        "n": "createBodyGraph",
        "k": "helper"
      },
      {
        "n": "createBodyGraph",
        "k": "helper"
      },
      {
        "n": "createBodyRouter",
        "k": "helper"
      },
      {
        "n": "createSearchIndex",
        "k": "helper"
      },
      {
        "n": "createSearchIndex",
        "k": "helper"
      },
      {
        "n": "createSpeciesRegistry",
        "k": "helper"
      },
      {
        "n": "createSpeciesRegistry",
        "k": "helper"
      },
      {
        "n": "derivePlacements",
        "k": "helper"
      },
      {
        "n": "derivePlacements",
        "k": "helper"
      },
      {
        "n": "diffDatasets",
        "k": "helper"
      },
      {
        "n": "diffDatasets",
        "k": "helper"
      },
      {
        "n": "expand",
        "k": "helper"
      },
      {
        "n": "hashOffset",
        "k": "helper"
      },
      {
        "n": "hashOffset",
        "k": "helper"
      },
      {
        "n": "installShippedSpecies",
        "k": "helper"
      },
      {
        "n": "inverseRelation",
        "k": "helper"
      },
      {
        "n": "inverseRelation",
        "k": "helper"
      },
      {
        "n": "isId",
        "k": "helper"
      },
      {
        "n": "isId",
        "k": "helper"
      },
      {
        "n": "loadBody",
        "k": "helper"
      },
      {
        "n": "makeId",
        "k": "helper"
      },
      {
        "n": "makeId",
        "k": "helper"
      },
      {
        "n": "normalizeRelation",
        "k": "helper"
      },
      {
        "n": "normalizeRelation",
        "k": "helper"
      },
      {
        "n": "packPlacements",
        "k": "helper"
      },
      {
        "n": "packPlacements",
        "k": "helper"
      },
      {
        "n": "parseId",
        "k": "helper"
      },
      {
        "n": "parseId",
        "k": "helper"
      },
      {
        "n": "parseVariantKey",
        "k": "helper"
      },
      {
        "n": "parseVariantKey",
        "k": "helper"
      },
      {
        "n": "placementStats",
        "k": "helper"
      },
      {
        "n": "placementStats",
        "k": "helper"
      },
      {
        "n": "planQuery",
        "k": "helper"
      },
      {
        "n": "planQuery",
        "k": "helper"
      },
      {
        "n": "readLicenseManifest",
        "k": "helper"
      },
      {
        "n": "readSpecies",
        "k": "helper"
      },
      {
        "n": "readSpeciesDefinition",
        "k": "helper"
      },
      {
        "n": "relationLabel",
        "k": "helper"
      },
      {
        "n": "relationLabel",
        "k": "helper"
      },
      {
        "n": "renderReport",
        "k": "helper"
      },
      {
        "n": "renderReport",
        "k": "helper"
      },
      {
        "n": "resolveVariant",
        "k": "helper"
      },
      {
        "n": "resolveVariant",
        "k": "helper"
      },
      {
        "n": "result",
        "k": "helper"
      },
      {
        "n": "runPlan",
        "k": "helper"
      },
      {
        "n": "runPlan",
        "k": "helper"
      },
      {
        "n": "slugify",
        "k": "helper"
      },
      {
        "n": "slugify",
        "k": "helper"
      },
      {
        "n": "toCurie",
        "k": "helper"
      },
      {
        "n": "toCurie",
        "k": "helper"
      },
      {
        "n": "tokenize",
        "k": "helper"
      },
      {
        "n": "tokenize",
        "k": "helper"
      },
      {
        "n": "uberonAdapter",
        "k": "helper"
      },
      {
        "n": "unpackPlacements",
        "k": "helper"
      },
      {
        "n": "unpackPlacements",
        "k": "helper"
      },
      {
        "n": "validateDataset",
        "k": "helper"
      },
      {
        "n": "validateDataset",
        "k": "helper"
      },
      {
        "n": "validateLesson",
        "k": "helper"
      },
      {
        "n": "validateLesson",
        "k": "helper"
      },
      {
        "n": "validateMeshBinding",
        "k": "helper"
      },
      {
        "n": "validateMeshBinding",
        "k": "helper"
      },
      {
        "n": "validateModelManifest",
        "k": "helper"
      },
      {
        "n": "validateModelManifest",
        "k": "helper"
      },
      {
        "n": "validateProcess",
        "k": "helper"
      },
      {
        "n": "validateRegion",
        "k": "helper"
      },
      {
        "n": "validateRelationship",
        "k": "helper"
      },
      {
        "n": "validateRelationship",
        "k": "helper"
      },
      {
        "n": "validateSource",
        "k": "helper"
      },
      {
        "n": "validateSource",
        "k": "helper"
      },
      {
        "n": "validateSpecies",
        "k": "helper"
      },
      {
        "n": "validateSpecies",
        "k": "helper"
      },
      {
        "n": "validateStructure",
        "k": "helper"
      },
      {
        "n": "validateStructure",
        "k": "helper"
      },
      {
        "n": "validateSystem",
        "k": "helper"
      },
      {
        "n": "validateVariant",
        "k": "helper"
      },
      {
        "n": "validateVariant",
        "k": "helper"
      },
      {
        "n": "variantKey",
        "k": "helper"
      },
      {
        "n": "variantKey",
        "k": "helper"
      }
    ]
  }
}
