Skip to main content

How Masar Works

Masar is a world model service: it maintains a learned understanding of how structured data should look, how it should be built, and how to tell whether a given result is correct. This page explains the four core capabilities at a high level.

Shared Representation Space

Every schema that passes through Masar gets converted into a compact vector representation. This representation captures the structural meaning of the schema, not just its surface form. Two schemas that accomplish the same thing in different ways will have similar representations.

This shared space is the foundation for everything else. Planning uses it to measure distance between current state and goal. Verification uses it to compare against known-valid examples. Memory uses it to find similar past experiences.

Planning via Structural Comparison

When you ask Masar to plan, it compares your current schema against the goal in representation space. The difference between the two representations maps to a sequence of concrete actions: add this entity, create that state machine, wire these transitions.

The result is a dependency-ordered instruction set. Level 1 actions have no prerequisites. Level 2 actions depend on Level 1 being done. This ordering means an agent can execute the plan step by step without guessing what comes next.

Planning also draws on golden behaviors: curated examples of correct, complete schemas. When your goal matches a golden behavior, planning becomes precise because Masar has seen exactly where you're going.

Verification via Learned Models

Masar's verification models predict whether a schema is valid and what errors it likely contains. These models were trained on thousands of schemas with known outcomes, so they can catch problems in milliseconds without running a full compiler pass.

Verification returns two things: a validity probability (how likely the schema compiles and runs correctly) and error category predictions (which specific problems are most likely present). An agent can use these predictions to decide whether to continue, backtrack, or apply targeted repairs.

Memory via Episode Clustering

Every completed task is an episode: the starting context, the actions taken, and the outcome. Masar stores these episodes and groups similar ones into clusters. Over time, clusters become patterns: generalized action sequences that work for a class of problems.

When a new task arrives, Masar searches for episodes with similar context and returns the best-matching pattern. This turns an agent's past work into reusable expertise. The agent that handled 200 helpdesk tickets doesn't start from scratch on ticket 201.

Putting It Together

A typical Masar-powered agent loop:

  1. New task arrives
  2. Recall: Search memory for similar past tasks
  3. Plan: Generate instructions (informed by recalled patterns if available)
  4. Execute: LLM follows each instruction
  5. Verify: Check the result after each step or at the end
  6. Repair: If verification fails, get repair suggestions and iterate
  7. Store: Save the completed episode to memory

Each cycle makes the next one faster and more accurate.

Next Steps