Patterns & Recipes
This page collects modeling patterns that work well in practice. Each pattern builds on the core primitives — shapes, things, assertions, and wrefs.
Agent Memory
Section titled “Agent Memory”An agent writes observations as assertions about entities it encounters:
- Define a
Locationshape (or whatever your domain entities are) - Define an
ObservationorBeliefshape with fields likeconfidence,source,evidence - The agent adds things as it discovers entities
- The agent creates assertions about those things as it learns
- Other agents (or humans) query those assertions to build on that knowledge
# Agent discovers a new entitywh commit submit --add cave --shape Location --data '{"x": 3, "y": 7}' -m "Discovered cave"
# Agent records what it observedwh assertion create --shape Observation --about Location/cave \ --data '{"safe": true, "confidence": 0.8, "source": "agent-1"}' -m "Initial observation"Knowledge compounds — each session builds on the previous one. The agent doesn’t start from zero because its prior assertions persist.
Multi-Agent Collaboration
Section titled “Multi-Agent Collaboration”Multiple agents write to the same repo. Each commit is attributed, so you can trace who said what:
- Agent A and Agent B can both assert about the same thing
- Their assertions coexist — WarmHub doesn’t force consensus
- A downstream process can compare, reconcile, or aggregate their views
# Agent 1's assessmentwh assertion create --shape Thesis --about Company/acme \ --data '{"outlook": "bullish", "confidence": 0.7}' -m "Agent 1 thesis"
# Agent 2's competing assessmentwh assertion create --shape Thesis --about Company/acme \ --data '{"outlook": "bearish", "confidence": 0.6}' -m "Agent 2 thesis"
# Both coexist — query to comparewh thing about Company/acme --shape ThesisThis pattern works because assertions are attributed and non-exclusive. There’s no conflict — just different perspectives.
Evolving Understanding
Section titled “Evolving Understanding”As knowledge changes, revise assertions rather than retracting and recreating:
reviseupdates the assertion’s data while preserving its identity and history- The
aboutreference stays the same (it’s immutable) - You can query the full version history to see how understanding evolved
# Initial belief (explicit name so we can revise it later)wh assertion create --shape Belief --name cave-safe --about Location/cave \ --data '{"safe": true, "confidence": 0.8}' -m "First visit"
# Confidence changes after new evidencewh assertion revise Belief/cave-safe --data '{"safe": false, "confidence": 0.3}' -m "Found hazard"Only retract when an assertion is truly no longer valid — not just outdated. Revision preserves the full belief trajectory.
Opinions as Separate Assertions
Section titled “Opinions as Separate Assertions”When modeling subjective logic opinions (b, d, u, α) — belief, disbelief, uncertainty, and base rate (serialized as the a field in JSON) — keep opinion metadata separate from the data being asserted. These values describe trust in an assertion, not properties of the thing being described.
Don’t do this — mixing finding data with opinion metadata:
{ "shape": "DocFinding", "data": { "severity": "high", "category": "security", "b": 0.8, "d": 0.1, "u": 0.1 }}Do this — a finding thing and a separate opinion assertion about it, in one write request:
wh commit submit --ops '[ {"operation": "add", "kind": "thing", "name": "DocFinding/finding-$1", "data": {"severity": "high", "category": "security"}}, {"operation": "add", "kind": "assertion", "name": "Opinion/finding-opinion-$2", "about": "DocFinding/finding-#1", "data": {"b": 0.8, "d": 0.1, "u": 0.1, "source": "scanner-agent"}}]' -m "Security finding with scanner confidence"Why separate?
- The finding’s severity is a fact — it doesn’t vary by who observed it
- The opinion (
b: 0.8) is the scanner agent’s confidence in that finding — another agent might disagree - Multiple agents can hold different opinions about the same finding
- You can query all opinions about a finding and fuse them without touching the finding data
This separation follows the same principle as things vs assertions: data about the world goes in things; beliefs about that data go in assertions.
If you want WarmHub to consolidate opinions across sources and weight them by track record, install Veritas — its Certainty, Support, Opposition, and Consensus shapes implement this pattern directly. Veritas’s installed shapes use the long-form field names belief, disbelief, uncertainty, and alpha. The (b, d, u, α) notation in this section is the mathematical form; user-defined opinion shapes (like the DocFinding/Opinion example above) typically serialize those as the short JSON keys b, d, u, and a. Pick the field-name convention that matches the shape you’re writing against.
Under-Grouping
Section titled “Under-Grouping”Hit a problem or have a question? Get in touch.