Skip to content

Reading answers

Every answer is expressed in WarmHub’s own data model, so you read an answer the way you read WarmHub data. An answer is a small graph: existing Things that it cites, plus new collections, assertions, and local Things that exist only in the answer.

An Answer response carries the graph in its answer field:

type ShapedAnswer = {
root: NodeRef; // The answer itself
nodes: Record<LocalId, AnswerNode>; // New collections, assertions, and local Things
things: Record<PinnedWref, ThingSnapshot>; // Existing Things that the answer cites
};
type NodeRef = LocalId | PinnedWref; // "_:pair" or "wh:org/graph/name@v2"
type AnswerNode =
| { kind: "collection"; type: "Set"; members: NodeRef[] }
| { kind: "collection"; type: "List"; items: NodeRef[] }
| { kind: "collection"; type: "Arc"; from: NodeRef; to: NodeRef }
| { kind: "collection"; type: "Bond"; ends: [NodeRef, NodeRef] }
| { kind: "assertion"; shape: string; about: NodeRef; data: object }
| { kind: "thing"; shape: string; data: object };
type ThingSnapshot = { shape: string; name: string; durableId?: string; data: unknown };
  • root is the answer. It’s either a pinned wref to an existing Thing, or a local ID such as _:share that names a node in nodes.
  • nodes holds the new collections, assertions, and local Things. Their IDs start with _: and mean something only inside this answer.
  • things holds a snapshot of each existing Thing the answer points to, keyed by its pinned wref.

A local Thing, kind: "thing", is something that isn’t in WarmHub, such as a listing a hub read from an outside API. It has a shape and data like any Thing, but no wref: only its local ID, such as _:listing. Assertions can be about it, and it can be the root or a member of a collection.

A node’s shape is either a pinned shape ref, such as wh:org/graph/Shape/Name@v2, or the bare name of a shape the hub defines itself, such as Quote. The Answer carries the definition of each bare-named shape in its shapes field; see Label assertion fields.

Every wref inside an assertion’s or local Thing’s data, such as a method or a geometry, is pinned to a version, so the answer records exactly which evidence it used. A Set or List holds at most 1,000 members.

Each kind of question answers with one of these patterns:

PatternRoot
One ThingA pinned wref
Several ThingsA Set or List of pinned wrefs
A measurement of one ThingAn assertion about a pinned wref
A measurement of an ordered pairAn assertion about an Arc
A measurement of an unordered pairAn assertion about a Bond
A collection of measurementsAn assertion about a Set or List whose members carry their own assertions
A measurement of something only an outside API holdsAn assertion about a local Thing

For example, a question that asks for Wake County’s ANSI code answers with one Thing: the root is the county’s pinned wref, and nodes is empty.

{
"root": "wh:warmhub-data/us.geography/county/identity/ansi/01008592@v1",
"nodes": {},
"things": {
"wh:warmhub-data/us.geography/county/identity/ansi/01008592@v1": {
"shape": "wh:warmhub-data/us.geography/Shape/County@v1",
"name": "county/identity/ansi/01008592",
"durableId": "040T0Z3ZDZBQ9R451D6H0H8BYVAG383WQBSF6WPFKHESZ31X8RSMA4F5F1C0",
"data": {
"geoid": "37183",
"ansiCode": "01008592",
"officialName": "Wake County",
"sourceRecord": "040T0Z3ZDZBQ9R451D6H0H8BYVAG383WQB99JWVBPSFB9BN0DZA3C7H5E7A0@v1"
}
}
}
}

A measurement of a pair nests one level further. “What percentage of Wake County’s total area does Raleigh occupy?” answers with an assertion, _:share, about an Arc, _:pair, from Raleigh to Wake County. The assertion’s data holds the share and the areas it was computed from.

Sources, confidence, and the rest of the response

Section titled “Sources, confidence, and the rest of the response”

Beside answer, an Answer response carries:

  • provenance: the answer’s sources, each with a label to show and either the wref of a WarmHub thing or the url of an outside source’s public page, such as an API’s documentation. Each entry is the hub’s own statement of its source; WarmHub doesn’t check it. WarmHub Ask shows these as Sources.
  • confidence: from 0 to 1. Answers that look up data directly have a confidence of 1.
  • hub, intent, and toolVersion: which hub answered, the kind of question it read yours as, and the version of the code that answered.
  • answerId: the answer’s durable ID. Keep it if you might reject the answer later.
  • shapes: only when the answer uses shapes the hub defines itself: each one’s definition, keyed by its bare name. See Label assertion fields.

References inside a Thing’s data, such as sourceRecord above, are WarmHub durable IDs, not wrefs.

A cited Thing lives in a WarmHub graph. When you can read that graph, for example because it is public, open the Thing by its wref like any other: with the WarmHub MCP server, wh thing view, or the SDK. A durable ID opens in the browser at https://wref.ai/<durableId>.

To show what each field of an assertion or local Thing means, look up its shape:

  • A pinned shape ref, such as wh:warmhub-data/us.geography/Shape/County@v1: when you can read its graph, write it as a WarmHub wref by replacing Shape/<Name> with hub/shapes/<Name>, such as wh:warmhub-data/us.geography/hub/shapes/County@v1, and open that, for example with wh thing view. It gives each field’s type, whether it’s optional, and its description.
  • A bare name, such as Quote: the hub defined the shape in its toolset, not in WarmHub, so WarmHub can’t return it. Read it from the answer’s own shapes field instead: { description?, fields }, keyed by the name, with fields in WarmHub’s shape field format, where a name ending in ? marks an optional field. The answer’s toolVersion identifies that definition, so two answers from different toolsets can define the same name differently.
"shapes": {
"Quote": { "description": "A book's price at a bookseller", "fields": { "price": { "type": "number", "minimum": 0 }, "currency?": "string" } }
}

The Exchange never writes answers into a WarmHub graph (formerly called a repo). Each local node in an answer corresponds to one WarmHub add operation, a collection, an assertion, or a Thing, without a permanent name. To keep an answer, give each local node a name and write it to your own graph. A node whose shape is a bare name needs that shape in your graph first: create it from the definition in the answer’s shapes.