Skip to content

Architecture Overview

中文:架构总览

UModel: local-first service with public API, CLI, Web UI, SDK, and MCP surfaces over one set of domain services.

System View

Layers

LayerPathsResponsibility
Entrycmd/umodel-server, cmd/umctl, cmd/umodel-mcpProcesses, flags, local runtime entry points.
API adaptersapi/openapi, api/mcp, internal/bootstrapREST routing, MCP schema exposure, server wiring.
Application servicesinternal/workspace, internal/umodel, internal/entitystore, internal/query, internal/agentgatewayUse-case logic for workspaces, model writes, runtime writes, reads, and agent access.
Contractspkg/contract, pkg/model, pkg/errorsPublic service interfaces, shared types, stable error envelopes.
Storage abstractioninternal/graphstoreProvider-neutral persistence and graph access.
Providersmemory, file.memory, local.ladybugRuntime storage implementations.
Clientsweb, sdk/go, sdk/python, generated/javaUser-facing and integration-facing clients.

Public Contract Rule

Public contract:

Implementation packages can change more freely than these surfaces. When a public contract changes, update docs, tests, examples, SDK expectations, and the Web UI in the same pull request.

Core Design Decisions

  • Workspace-scoped operations keep local data isolated.
  • Query Service is the only public read path for model, entity, and topology data.
  • EntityStore writes runtime objects and relations; it does not expose public read APIs.
  • UModel Service writes and validates model definitions.
  • AgentGateway uses Query Service for runtime rows and keeps resources metadata-oriented.
  • GraphStore providers hide persistence details from application services.

Architecture Guard

The repository includes an architecture guard at tools/guards/architecture_guard.py. Run it with:

bash
make guard

The guard protects key boundaries such as no public domain read APIs outside Query Service and no direct provider imports from business modules.

Released under the Apache-2.0 License.