Skip to content

Repository files navigation

Meterless World Model Hero Image

Meterless World Model

A persistent, queryable, evolving graph of entities, contexts, and relationships. Domain-agnostic. Append-friendly. Idempotent.

License Architecture Status

Architecture · Data Model · Pipeline · Read Surface


What is a Meterless World Model

A world model is a persistent, queryable, evolving representation of things, the contexts they appear in, and the relationships between them.

This repository documents the architecture in domain-agnostic terms. The same architecture runs across very different domains:

Domain Entity Context Relationship
Narrative tools Characters, props, locations Scenes, snapshots Appears with, conflicts with
News aggregators Articles, publishers, figures Stories, topics, hashtags Cited by, contradicts
Knowledge bases Documents, claims, authors Topics, citations Supports, refutes
Agent platforms Tasks, tools, observations Sessions, world state Depends on, blocks
Games and simulations Actors, items, regions Events, ticks Owns, faction-aligned
Product analytics Users, features, sessions Cohorts, releases Used by, derived from
CRM and sales Companies, contacts, deals Quarters, signals Reports to, won by
Scientific bases Molecules, papers, experiments Studies, citations Cites, builds on
IoT and monitoring Devices, streams, incidents Regions, time windows Located at, triggered by
Compliance and risk Entities, transactions, alerts Lists, periods Sanctioned by, related to

If your product needs to remember things, reason about them, and display them, this architecture applies.


Why use a World Model?

Meterless World Model Power Agents

A canonical store for the entities, contexts, and relationships your agents need to share. Idempotent ingest, stable IDs, schema-versioned storage, derived views that can be rebuilt from the log, and an operator surface for inspecting and repairing the model.

That's the mechanics. The reason it matters is bigger.

Most AI systems today are amnesiac. They re-discover the same accounts, the same characters, the same world every conversation. Memory is per-session; understanding is shallow; nothing accumulates. You can scale parameters all you want — without a shared world, the system never becomes situated in anything.

World Model is the substrate for agents that know where they are. A persistent, queryable, evolving picture of the world the system operates in — the people in it, the histories they carry, the relationships they hold, the situations they're inside. Once that exists, agents stop guessing and start reasoning from grounded state. Continuity replaces context-stuffing. Identity replaces inference. Behavior gets uncannier — not because the model got smarter, but because for the first time it has somewhere to stand.

That's the unlock. The mechanics are how you build it. The world is what you get.


Quickstart

This repo is the implementation spec, not a runtime library. You can download the AGENTS.md alone. Or clone the repo, open it in your coding agent, and let AGENTS.md guide the build into your stack.

gh repo clone meterless/world-model
cd world-model
# Open in Claude Code, Cursor, Codex, or any AGENTS.md-aware agent

Then prompt your agent: "Implement the World Model engine in this project following AGENTS.md."

The agent will pick your aggregate shape (timeline or stream), help you define entity types, scaffold the pipeline, build the read surface, and wire up the control plane. Architectural reference in /docs.


Architecture

flowchart LR
  A[Raw input<br/>narrative · stream · observation] --> B[Pipeline<br/>derive entities and contexts]
  B --> C[Stable Hash IDs<br/>content-derived, not autoincrement]
  C --> D[(Canonical Store<br/>versioned schema)]
  D --> E[Derived Views<br/>latest-version · canonical merged · sparklines]
  D --> F[Read Surface<br/>queries · projections · context builders]
  D --> G[Enrichment Pipelines<br/>per entity, bounded blast radius]
  F --> H[Downstream<br/>UI · ranking · retrieval · generation]
  D --> I[Control Plane<br/>operator UI]
Loading

The store is the source of truth. Every derived view can be rebuilt. Failures in one entity's enrichment do not poison the rest of the world.


Two recurring shapes

Most production world models are one of these or a hybrid.

Timeline of snapshots

World
  ├─ id, name
  ├─ snapshots: Snapshot[]
  │     ├─ timestamp
  │     ├─ context (config, location, scene)
  │     └─ entities: Entity[]

Suits narrative tools, simulations, agent traces, game state. Each snapshot is a complete view. Entities exist within the snapshot.

Stream-clustered facts

World
  ├─ id, name
  ├─ stream: Observation[]
  ├─ aggregates: Aggregate[]   // stories, topics, incidents
  └─ canonical_entities: Entity[]

Suits research, news, monitoring, intelligence. A stream of incoming items is clustered into higher-order aggregates. Canonical entities are recomputed from the stream.

Pick the one that matches how your domain accumulates state.


Meterless World Model Adapt

The pipeline

Every ingest path runs the same ordered steps:

  1. Normalize input. Canonical text, language, timestamps, source provenance.
  2. Derive entities. Type, name, attributes, candidate IDs.
  3. Resolve to canonical IDs. Hash-based, deterministic.
  4. Append observation. New snapshot or stream entry.
  5. Enrich. Bounded per-entity workers. One failure does not block others.
  6. Recompute derived views. Latest-version maps, canonical merged entities, sparklines.

Re-running on the same input produces the same world. Idempotent by construction.


The read surface

Consumers do not query the canonical store directly. They go through a read surface that provides:

  • Lookups. Single-entity, single-context, single-relationship.
  • Projections. Latest version, merged canonical view, sparkline over time.
  • Context builders. Pack entities, contexts, and relationships into prompts or UI views with a token or row budget.
  • Provenance. Every read can trace back to the rows that contributed.

Generation, retrieval, ranking, and the UI all call into the same read surface. There is one source of truth and one access pattern.


Concurrency and consistency

Append-friendly storage tolerates concurrent writes naturally. The model recommends:

  • Single-writer per entity for enrichment, multiple readers anywhere.
  • Queue enrichment work. Worker pools per entity type. Backpressure on bursts.
  • Eventual consistency on derived views. Reads against the canonical store are strongly consistent. Reads against derived views are typically rebuilt within seconds.
  • Schema-versioned storage. Migrations are explicit and inspectable.

The operator control plane

Meterless World Model Single Source

A world model needs a control plane, not just an API.

Operators inspect entities, contexts, and relationships. They merge duplicates. They split conflated entities. They mark canonical preferences. They trigger re-enrichment.

The control plane writes back into the canonical store the same way the pipeline does. There is no privileged path.

That is how the model stays trustworthy.


What you get for free

  • Idempotent ingestion. Re-run, backfill, repair without duplication.
  • Stable cross-process identity. Hash IDs let any worker resolve any entity.
  • Bounded blast radius. One bad entity does not break the world.
  • Schema versioning. Migrations are inspectable and reversible.
  • Provenance. Every derived value traces back to the rows that produced it.
  • Portable storage. The same architecture runs client-side on IndexedDB, server-side on Postgres, or distributed across workers and queues.

What this is not

  • Not a graph database. It uses one (or doesn't) underneath.
  • Not a vector store. It uses one for enrichment if you want.
  • Not domain-specific. Characters and articles and devices use the same shape.
  • Not a chat memory. Pair it with H-MEM if you want both.

Reusable principles

If you only adopt three things from this repo:

  1. Hash-based stable IDs. Stop using autoincrement for entities.
  2. Append-only canonical store. Recomputed derived views. No silent mutations.
  3. Bounded blast radius on enrichment. One worker per entity. Failures isolated.

Those three principles take a system from "works in demo" to "survives production."


Trade-offs and portability

Be honest about the costs:

  • Idempotency requires deterministic enrichment. LLM calls inside the pipeline must be re-runnable or cached.
  • Derived views can lag. Reads against them are eventually consistent. Plan for that in your UI.
  • Hash IDs need name normalization. Get casing, whitespace, and diacritics right, or you create silent duplicates.
  • Append-only stores grow. Plan retention policies per entity type up front.

See docs/trade-offs.md.


Service boundaries

Implement as composable services or one binary. The contracts are the same:

  • IngestPipeline for normalize, derive, resolve, append
  • EntityResolver for stable ID generation and dedup
  • EnrichmentWorkers per entity type, bounded blast radius
  • DerivedViewBuilder for projections and materialized views
  • ReadSurface for queries, projections, context builders
  • ControlPlane for operator actions
  • MigrationService for schema versioning

Contributing

Open an issue with the domain and the aggregate shape before opening a PR. For new entity resolution heuristics, include the test corpus you used to validate (especially edge cases on naming and diacritics).

See CONTRIBUTING.md.


License

MIT. Use it. Fork it. Ship it.

About

No description, website, or topics provided.

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages