Return to LMIR

LMIR and intent lowering

Preserve decisions as intent becomes a specification grounded in software.

A representation within Engine

LMIR, Language Model Intermediate Representation, sits between a human request and work on a particular system. It records intended behaviour, constraints, references to software objects, and decisions still requiring resolution.

LMIR’s schema and the process for turning it into executable work are still being defined.

Meaning before implementation

A request contains an outcome, assumptions, and often unstated decisions. “Cache this response” leaves identity, lifetime, invalidation, consistency, and failure behaviour open. “Limit login attempts” leaves the counting scope and timing model open. Generating code forces choices about these questions even when the request has not settled them.

LMIR gives those choices an explicit place. It preserves the intended behaviour and the decisions that determine what a correct implementation would mean. An unresolved field should remain unresolved until evidence, a policy, or a person supplies a decision. Defaults need a stated origin and scope so they can be inspected and changed.

This separates the requirement from a particular implementation choice. A constraint can survive a refactor or a different storage strategy, provided the resulting software still satisfies the agreed behaviour.

Lowering in stages

  1. Request: retain the person’s intended outcome.
  2. Behaviour: identify the action or property being changed.
  3. Constraints: resolve scope, limits, timing, failure behaviour, and invariants.
  4. Software semantics: refer to the affected operation and the current software model.
  5. Work: connect each constraint to operations and checks in Work IR.

A missing decision remains unresolved. A chosen value needs a reason or source, so later changes can revisit the decision without reconstructing it from generated code.

Grounding intent in existing software

Lowering needs to connect an abstract requirement to actual software objects. The software-understanding layer supplies candidate entrypoints, interfaces, dependencies, and evidence. LMIR retains the resolved references and the source state that supported the choice.

A cache requirement might attach to an operation with known inputs and consumers. That grounding helps reveal whether identity is request-specific, user-specific, tenant-specific, or shared. Analysis supplies facts about the system; it cannot decide the desired product semantics on its own.

The boundary is useful in both directions. A requirement can guide which relationships to inspect, and the inspection can expose a decision the request omitted. For example, a shared operation used by several tenants makes an unspecified cache scope consequential. Lowering should surface that question before implementation.

Decisions, constraints, and invariants

A constraint describes required behaviour. A decision resolves a choice needed to realize it. An invariant describes behaviour that must remain true through the change. Keeping these roles distinct makes a specification easier to review.

For a cache, the lifetime may be a chosen policy, freshness may be a requirement, and tenant isolation may be an invariant. A storage option must satisfy all applicable requirements. A conflict between them should remain visible rather than being silently resolved by an implementation.

Each item needs a stable reference within the specification. Work can refer to the constraints it serves, and verification can record the observations that address them. A changed decision should identify the dependent operations and checks that need reconsideration.

Information to retain

FieldPurpose
Behaviour and targetName what should change and the software object it affects
ConstraintsRecord requirements with stable identifiers
DecisionsRetain resolved choices, their context, and remaining ambiguity
Source referencesGround the target in a software model and revision
Verification requirementsDescribe the observation that would establish each constraint

These are conceptual fields, rather than a finalized serialization or API.

Example: resolve a login-limit request

The request “allow five login attempts per minute” leaves identity, timing, and failure behaviour open. For this worked example, a person explicitly chooses:

ConstraintAgreed decisionRequired observation
C1: scopeCount by an agreed client identifierDifferent clients have separate counts
C2: limitAllow five attempts in a fixed 60-second windowAttempts 1–5 pass the guard
C3: rejectionReturn HTTP 429 on attempt 6The rejected request does not enter authentication
C4: resetStart a fresh count at the next window boundaryAn attempt in the new window passes the guard
C5: invariantPreserve existing authentication behaviour for allowed requestsExisting authentication checks still pass

The software target is the login operation identified by Engine’s model. Work IR retains C1–C5 as references when it describes the edit and tests. Storage and concurrent counting remain unresolved in this example; they must be settled before execution.

An interface for different actors

An analyst can resolve a software target, a person can choose a policy, a model can propose a specification, and a tool can check its internal consistency. They need to share the same current specification and preserve the basis for each change.

Structured decisions are particularly useful when the alternatives are already known. Selecting a scope from a defined set or choosing among resolved targets has a smaller decision surface than generating a complete implementation. The representation makes that surface explicit while retaining the surrounding constraints.

The public contract describes the information and relationships these actors need. The specific encoding, decision procedures, and learning methods remain implementation concerns. The value of LMIR should be assessed through the decisions it preserves and the work it enables.

Choosing the computation

Software analysis can establish facts within its coverage. Structured choices can select among known targets or scope values. Generative models can help interpret open-ended requests. Once decisions are sufficiently explicit, a transformation may be carried out by a deterministic tool. LMIR makes the inputs and outputs of those stages inspectable; it does not guarantee that every request can be lowered automatically.

Validating the specification

Before work begins, validation should identify missing decisions, contradictory requirements, unresolved software references, and requirements without an observation strategy. This establishes readiness for the next stage; it does not establish that the intended behaviour has been implemented.

After work, verification compares the resulting software and observations with the same specification. If the result meets the written constraints but misses the person’s intended outcome, the specification needs revision. Preserving that distinction helps explain whether a failure belongs to interpretation, planning, or implementation.

LMIR should also be evaluated across equivalent requests expressed in different language, revisions of a requirement, and changes in source state. The question is whether it retains the meaning needed for correct work while making uncertainty and correction inspectable.

Further reading