DEV Community

Nishchya Verma
Nishchya Verma

Posted on

UI Is Not a View Layer. It’s an Interface Contract.

CortexUi is an AI-native interface system built on this exact idea: UI should be operable by humans visually and by intelligent agents programmatically. The project lives on GitHub, and the full docs are available at cortexui.llcortex.ai.

Frontend developers have spent years talking about UI as a view layer.

That framing is too small.

A serious interface is not just something that looks good and responds to clicks. It is the operational boundary between a system and whoever is trying to use it. For years, that “whoever” was assumed to be a human. Now it is increasingly a human and a machine.

Once you accept that, the way we talk about UI starts to feel outdated.

Backend engineers have been trained to think in contracts for decades. A good API is explicit. It names its endpoints. It declares its inputs. It specifies success and failure modes. It gives clients something stable to build against.

We treat API contracts as real architecture.

But on the frontend, we routinely ship interfaces where the semantics are implied rather than declared. A button has a label, not an identity. A form has fields, but no machine-readable schema. A loading state exists visually, but there is no explicit contract that says, “this action is in progress, do not trigger it again.”

Humans cope with this because humans are excellent at inference.

Machines are not.

That is the philosophical core of CortexUI: UI should be designed with the same contractual rigor we expect from APIs.

Not because we want to make frontend feel like backend.

Because modern software now has non-human operators.

The CortexUI worldview is built on a few strong ideas.

First: UI is an interface, not decoration.

The visual layer matters. A lot. Good typography, spacing, accessibility, hierarchy, and motion are part of how humans understand software. CortexUI does not reject any of that.

But visual design is only one half of the job.

The second half is semantic clarity. What is this element? What action does it trigger? What state is it in? What entity does it belong to? What section of the workflow am I looking at?

If those answers only exist in a human’s head, the UI is incomplete.

Second: interfaces should be deterministic.

An agent should not need to infer whether a button is a destructive action, a primary action, or a navigation affordance based on color and placement. It should not need to guess whether a spinner means “loading” or whether a quiet layout change means the action succeeded.

Determinism means the interface declares what is true right now.

A CortexUI element carries explicit identity and state:

  • data-ai-id for stable identity
  • data-ai-role for semantic type
  • data-ai-action for executable intent
  • data-ai-state for current condition
  • data-ai-screen and data-ai-section for context
  • data-ai-entity and data-ai-entity-id for domain anchoring

This is not metadata as decoration. It is metadata as architecture.

Third: actions should be first-class.

Traditional UI often treats actions as the byproduct of components. There is a button. The button has some text. Somewhere in code there is an onClick. The action is hidden inside implementation.

CortexUI flips that. The action becomes the thing you design around.

What is the action called? When is it available? What does success look like? What does failure look like? What state transitions can it go through? What entity does it operate on?

That is a better design discipline even before AI enters the picture.

Once you are forced to name an action explicitly, ambiguity gets harder to hide.

Fourth: interfaces should have a dual layer.

This is one of the most useful ways to think about CortexUI.

There is a human layer:
the visible UI, layout, style, interaction polish, accessibility affordances, responsive behavior.

And there is a machine layer:
the contract that exposes identity, meaning, state, and available operations to agents, tests, and runtime tooling.

These layers are not in conflict. They coexist.

A human still sees a clean form and a clear primary button. An agent sees a form schema, field types, required flags, and a stable action identifier.

Same interface. Two consumers. One contract.

That dual-layer model matters because the current alternative is terrible. Without an explicit machine layer, AI systems end up reading interfaces the same way a human with blurred vision might: making guesses from incomplete evidence. That produces brittle automation, unreliable copilots, fragile end-to-end tests, and endless maintenance every time a UI changes.

A contract layer changes that.

Stable identity means an action remains targetable even if the copy changes from “Save” to “Update profile.”

Observability means an agent can inspect current state instead of deducing it from pixels.

Explicit state means a system can know that an action is loading, a field is in error, or a modal is expanded without guessing.

This is why CortexUI is not just another component library.

A component library helps you render UI.

A contract system helps you make UI operable.

That distinction will matter more every year.

The future of software is not just people clicking around inside browsers. It is people, agents, automations, test runners, copilots, and monitoring systems all interacting with the same interfaces. The teams that win in that world will not be the ones with the prettiest buttons alone. They will be the ones whose interfaces are explicit, stable, observable, and trustworthy.

The frontend world spent years optimizing for how software looks.

The next frontier is optimizing for how software declares itself.

That is the deeper idea behind CortexUI.

Not prettier components.

Interfaces that can be understood.

If that model resonates, explore CortexUI on GitHub and read more at cortexui.llcortex.ai.

Top comments (0)