Leumas Body
The BODY primitive — a species-agnostic anatomical graph and the Human Atlas over it. Read before touching @leumas/body, the atlas, or any anatomical claim.
Body — the organism primitive
Leumas understands files, devices, networks, APIs, workflows and 3D scenes. BODY is the primitive that makes it understand organisms: systems, structures, the typed relationships between them, and the processes they take part in. The Human Atlas is the first interface on top of it, not the thing itself.
The one claim everything here is built around
The 3D model is not the body. The body is a structured biological graph; a mesh is one representation hung off a node of it.
Every question the atlas answers is answerable with no geometry loaded. Almost every structure has no mesh at all and is fully searchable, traversable and citable. That is what makes the atlas scriptable from an MCP client with no viewer, usable without a GPU, and correct about the part of the body nobody has modelled.
An agent that reads "not drawn" as "not present" will report most of the body missing.
Most positions in this atlas were DERIVED, not authored. The human body plan places every bone, every named joint, every muscle group, the whole viscera and the major vessels and nerves by hand; everything else is put inside whatever the ontology says contains it. The dog is still at its original ~110.check:bodyprints the live split — never quote a count from here. Every one carries its tier and a sentence explaining it —body.describe(id).placement, or thegetPlacementtool. Quote the explanation, never the coordinates alone.docs/placement.md.
Where things are
| Thing | Where |
|---|---|
| The engine — graph, search, registry, validation, adapters | shared/packages/body/ (@leumas/body) |
| The 3D viewer, layer system, command executor | shared/packages/body-viewer/ (@leumas/body-viewer) |
| The app — listing, 22 agent tools, MCP, REST, domain claim | shared/apps/body-atlas/ |
| The Studio domain — Explore, Tree, Graph, Lessons, Sources | products/leumas-studio/src/admin/body/ |
| The API | /api/body, mounted in products/leumas-api/src/app.js |
| The importer | ops/tools/anatomy-ingest/ — pnpm anatomy:update uberon |
| The guard | pnpm check:body (self-tests) · pnpm test:body |
| Developer docs | shared/packages/body/docs/ — one file per "how do I add a …" |
The vocabulary, in six lines
- Species —
human,test-organism. Data, listed indata/species/index.js. - Variant —
adult-male,adult-female. Sex is a variant, never a global switch. - Structure —
anatomy:<species>:<slug>. The only key anything is synchronised by. - System / Region —
system:human:skeletal,region:human:hand. Groupings, not graph nodes. - Relationship — one of 64 closed types (
GET /api/body/relations). An invented one
traverses to nothing while every guard passes.
- Process —
process:human:respiration. Physiology, in the same graph, its own id class.
Answering an anatomy question
Always through the graph. Never from memory.
POST /api/body/human/adult-female/ask { "question": "What supplies the heart with blood?" }
→ { plan, facts, structures[], visualActions[], sources[], note }
facts is the answer, sources is where it came from, visualActions drives the viewer. Put the facts into English afterwards — do not substitute your own recall when answerable: true.
When answerable: false, note says why, and the honest thing is to repeat it.
The four sentences to get right
- An empty relationship list is a statement about the DATA, never about the body. Every organ
has a blood supply; this dataset asserts one for a minority. Say "no arterial supply is recorded in this dataset" — the API already returns exactly that sentence in note.
- A fuzzy search hit is a suggestion, not a resolution. "femer"→"femur" scores identically to
"ileum"→"ilium", so no threshold separates a helpful correction from a dangerous one. resolve() refuses to promote one; so must you.
- The geometry is SCHEMATIC. Primitives at roughly the right position, not organ shape —
manifest.schematic === true, the viewer badges it, and any answer showing it must say so.
- A variant does not hide anatomy, it does not have it. The prostate is absent from the female
body everywhere — graph, search, relationships, manifest. Asking for it 404s, correctly.
Medical safety — the boundary that is not negotiable
This is an educational and informational anatomy platform. Not a diagnostic system, not a medical device, not a treatment or prescribing engine, not a substitute for a clinician. There is no verb that takes a symptom and returns a condition, and adding one is a different product.
Three kinds of statement, never blurred:
| Kind | May you produce it? |
|---|---|
| Anatomical fact — sourced from the graph | Yes, with its citation |
| Educational medical information — general, sourced | Yes, marked as general |
| Personal medical advice — about this person's body | No |
The agent tools
22 of them, from one defineLeumasApp declaration, so they are adapter functions, MCP tools, Leviathan functioncalls, REST routes and a typed SDK simultaneously. Read-only, permissions: [], no req.user anywhere in the engine.
listSpecies · listVariants · listSystems · listRegions · vocabulary · search · getStructure · getRelationships · getChildren · getParents · contains · getBloodSupply · getInnervation · getPath · getSubgraph · compareStructures · compareVariants · ask · getSources · listLessons · getLesson · getModelManifest · getPlacement · viewerCommand · stats
viewerCommand cannot reach a browser — nothing on the server can. It validates a visual instruction and returns it; the surface in front of the user executes it. The action list is closed and every id is checked to exist first, so the worst a hostile command does is change what is on screen.
Adding a species
A folder and a line. No engine code.
# 1. write data/species/<id>/ingest.profile.json (from an ontology)
# or the five dataset files by hand (curated)
# 2. add the id to SHIPPED_SPECIES in shared/packages/body/data/species/index.js
node ops/tools/anatomy-ingest/index.mjs update uberon --species <id>
node ops/tools/anatomy-ingest/index.mjs validate --species <id>
node ops/tools/anatomy-ingest/index.mjs schematic --species <id> # placeholder geometry
schematic also prints and commits the placement ratchet — what fraction of that body can be drawn at all. check:body fails when it falls; only re-running this raises it, which means a person saw the number.
That claim is enforced rather than hoped for: test/cross-species.test.js loads the synthetic test-organism — three systems that are not human systems — through the same registry, loader, validator, search index, graph and viewer, and asserts every surface works on it. Do not delete that species to make a refactor pass. It is the only thing that notices when the engine quietly learns what a heart is.
Before you touch anything
| You are about to | Read first |
|---|---|
| add a relationship type | src/relations.js — the vocabulary is CLOSED for a reason |
| change how a structure is selected into the human slice | data/species/human/ingest.profile.json — the _readme records an ingest that lost the pancreas |
| write an anatomical fact by hand | data/species/human/relationships.curated.json — every edge cites a chapter |
| add geometry | docs/adding-a-mesh.md — the manifest slot takes bundle+mesh instead of procedural, and nothing else changes |
| take a new dataset | data/licenses/manifest.json — and check shareAlike before anything else |
| add a viewer action | body-viewer/src/commands.js — the list is closed because a model writes into it |
| say where something is, in ANY surface or answer | docs/placement.md — four tiers, and only one of them means somebody looked |
| author or change a SHAPE in a body plan | docs/primitives.md — the nine primitives, which fields scale, and the four ways a shape draws wrong with no error |
| touch the instanced renderer | body-viewer/src/InstancedBody.jsx — six traps, every one of which renders perfectly while being wrong |
| change a body plan's positions | data/species/<id>/schematic.layout.json, then re-run anatomy-ingest schematic — it writes the coverage ratchet check:body holds you to |
Prove it
pnpm check:body # the dataset, the licences, the lessons, the manifests — and its own self-test
pnpm test:body # the engine suite + the viewer suite
pnpm anatomy:validate # every shipped species, as a report
Related
leumas-capabilities (where new code goes) · leumas-domains (the Studio domain contract) · leumas-guards (which guard proves what) · threejs-leumas (the 3D placement rules the viewer obeys).