Giving AI a Map of the System It Must Understand: Tessera Software Topology
The Navigation Problem in Legacy Systems
An artificial intelligence model can summarize a dense biography or compose a Shakespearean sonnet about a toaster, yet struggle to explain what happens when a customer clicks a button in an enterprise legacy application.
Given an unfamiliar codebase, modern Large Language Models frequently infer APIs that do not exist, bridge unrelated databases through imagined foreign keys, and treat aspirational slide decks as though they were deployed, runtime reality.
The failure is rarely a defect of raw intelligence. Understanding a production software system requires concrete, empirical evidence:
- Which components physically exist in the runtime environment?
- What state do they read, mutate, and persist?
- How does execution flow across boundaries?
- Which structural invariants prevent one subsystem from corrupting another?
In most organizations, these fundamental facts are not recorded in a coherent model. They remain fractured across legacy repositories, undocumented configuration flags, evolving database schemas, transient distributed traces, and tribal lore preserved solely in senior engineers’ heads.
Traditional architectural documentation rarely resolves this uncertainty. An informal diagram featuring a box labeled “User Profile” might represent a frontend React view, a MySQL database record, an internal microservice, or an entire organizational department. Similarly, an arrow drawn between two boxes might signify a synchronous HTTP/REST call, an asynchronous Kafka event, an in-memory function invocation, or merely a developer’s wishful thinking that has never been implemented.
Navigating a massive legacy system using typical box-and-arrow diagrams is like navigating Tokyo with directions that say: “Turn left where the old bakery used to be, then keep walking until you feel a gentle breeze.” A veteran engineer who has lived in the codebase for a decade might successfully navigate by intuition. An incoming engineer—and certainly an autonomous AI agent—requires exact geographic coordinates, explicit boundaries, and verifiable transit routes.
Tessera Software Topology applies this distinction to software systems. Rather than relying on intuitive prose or vague boxes, Tessera models architectures as discrete, typed, directed hypergraphs. By explicitly classifying every system primitive, boundary, state mutation, and message contract, it provides a unified, machine-readable topology that both human architects and AI agents can navigate, inspect, and mechanically verify.
A Small Vocabulary for a Complex System
Tessera builds upon foundational concepts from discrete mathematics, set theory, and graph theory. While the terminology sounds formal, the core architectural premise is deliberately minimalist.
In classical graph theory, a standard edge connects exactly two nodes. However, real-world software operations rarely operate as simple pairs: an incoming HTTP request may read session state from a Redis cache, query an account record from PostgreSQL, evaluate a business rule, persist an audit log, emit an outbound event to an SQS queue, and return a JSON response.
Representing this operation as a simple collection of pairwise lines obscures the atomic reality of the transaction. A directed hypergraph resolves this by allowing an edge (a hyperedge) to connect an arbitrary set of input nodes to an arbitrary set of output nodes. A typed directed hypergraph further attaches strict ontological classifications to every participating element.
Tessera defines the entire universe of modeled software elements, 𝒰, as the disjoint union of four fundamental, pairwise disjoint primitive sets:
𝒰 = 𝒜 ⊎ 𝒞 ⊎ 𝒟 ⊎ ℰ
The disjoint-union symbol (⊎) enforces a critical structural invariant: every element in the system belongs to exactly one primitive category.
| Primitive | Symbol | Operational Definition | Concrete Examples | Visual Archetype |
|---|---|---|---|---|
| Actors | 𝒜 | Entities external to the modeled system boundary that initiate intent or consume effects | Human end-users, third-party payment gateways, external cron daemons | Pill / Stadium (Dashed) |
| Compute Nodes | 𝒞 | Executable units responsible for state transformations and logic execution | HTTP controllers, background workers, service methods, AWS Lambda functions | Rounded Rectangle (Solid) |
| Data Stores | 𝒟 | Containers of persistent or retained state at rest | SQL tables, Redis keys, S3 buckets, append-only event ledgers | Cylinder |
| Events & Messages | ℰ | Ephemeral payloads and data structures in motion between participants | HTTP requests, webhook payloads, message queue envelopes, typed DTOs | Rectangle / Badge (Dashed) |
This strict classification prevents semantic collapse. In casual engineering conversations, an infrastructure product like PostgreSQL or Redis is frequently conflated with the application components running inside it. Under Tessera:
- A PostgreSQL table storing user accounts is classified strictly as a Data Store (𝒟).
- A PostgreSQL stored procedure executing business logic is modeled as a Compute Node (𝒞).
- A Redis queue maintaining messages is a Data Store (𝒟), while the transient payload pulled from it is an Event/Message (ℰ).
By assigning elements to primitive roles rather than physical server boxes, the model eliminates endless debates about what a commercial tool “is,” focusing purely on what role the element plays within an operational flow.
The Atomic Step: Transitions (τ)
The fundamental building block of system behavior in Tessera is the Atomic Step (or Transition), denoted as τ:
τ = (I, c, O)
The three components of a transition are constrained by strict mathematical invariants:
I ⊆ 𝒜 ∪ 𝒟 ∪ ℰ, c ∈ 𝒞, O ⊆ 𝒟 ∪ ℰ
Every transition represents a discrete execution context where:
- Inputs (I): The set of initiating actors, read-state data stores, and incoming message payloads required for execution.
- Compute (c): Exactly one executable compute unit responsible for orchestrating the transition.
- Outputs (O): The set of modified data stores (write effects) and emitted message payloads.
Notice that compute nodes are strictly forbidden from appearing in I or O. In Tessera, execution logic does not pass through another compute node as “data”; transitions hand off control exclusively through explicit, typed messages or state changes.
This formalization immediately derives auditable structural subsets:
Read Set: R(τ) = I ∩ 𝒟, Write Set: W(τ) = O ∩ 𝒟
Incoming Messages: E_in(τ) = I ∩ ℰ, Outgoing Messages: E_out(τ) = O ∩ ℰ
The Commercial Kitchen Analogy
To grasp why this strict separation matters, consider a commercial restaurant kitchen:
- The order ticket hung on the pass is an incoming message (E_in ∈ ℰ).
- The ingredients stored in the pantry and walk-in cooler represent retained state (R ⊆ 𝒟).
- The line chef preparing the meal is the compute node (c ∈ 𝒞).
- Plating the meal consumes pantry inventory (W ⊆ 𝒟) and emits an order-ready bell notification (E_out ∈ ℰ).
The distinction is obvious: the chef is not the tomato. Yet in software, codebases constantly conflate execution logic with the data structures it mutates. By isolating compute from state and messages, Tessera makes every operational footprint visible and queryable.
Journeys: Causal Continuity vs. Wishful Arrows
Features rarely execute within a single isolated transition. Multi-step business processes—such as e-commerce checkout, user identity verification, or automated billing—span multiple transitions. In Tessera, these sequential workflows are formalized as Journeys (𝒥):
𝒥 = (τ₁, τ₂, …, τₙ)
In traditional architecture diagrams, engineers draw a line from Service A to Service B and assume causation. But an arrow does not explain how execution transferred, what payload carried the context, or whether delivery guarantees exist.
Tessera eliminates speculative arrows through the Causal Chaining Condition:
E_out(τᵢ) ∩ E_in(τᵢ₊₁) ≠ ∅ for all 1 ≤ i < n
Every step in a declared journey must output a typed message that is explicitly declared as a valid input for the subsequent step. If step τ₁ emits an OrderPlacedEvent and step τ₂ requires a PaymentAuthorizationRequest, the chain is mathematically broken until an intermediary translation or explicit handoff is declared.
The chaining condition ensures that an AI agent cannot invent runtime workflows out of thin air. To validate a journey, the agent must prove continuous causal links across the entire hypergraph path.
Slices and Sovereign Ownership
Journeys describe how data travels horizontally across an application. Slices (𝒮) describe sovereign ownership vertically within the architecture.
In modular architectures and domain-driven design, teams attempt to carve out bounded contexts or microservices. But in practice, architectural drift degrades these boundaries: a new service is launched, yet monolith cron jobs continue reading its private database tables directly.
Tessera defines a Slice S as a sovereign ownership partition over a dedicated subset of compute nodes, C_S, and data stores, D_S. Distinct slices must maintain mutually disjoint ownership:
C_Sᵢ ∩ C_Sⱼ = ∅, D_Sᵢ ∩ D_Sⱼ = ∅ (for all i ≠ j)
All unassigned legacy components are grouped into the Monolith (M), representing the residual system:
C_M = 𝒞 \ ⋃_S C_S, D_M = 𝒟 \ ⋃_S D_S
The Sovereignty Rule
Declaring an independent country on a paper map does not grant geopolitical sovereignty if neighboring foreign troops freely march across its borders.
Similarly, creating a new Git repository and labeling it the “Inventory Microservice” does not establish a decoupled architecture if legacy monolithic code continues querying stock_levels directly through shared database credentials.
Tessera strictly separates ownership from access. While a data store has exactly one declared owner (D_S_inv), runtime execution might illegally touch it. This brings us to boundary detection.
Seam Crossings and the “Needle Piece”
A software migration or modernization initiative becomes concrete at its seams: the exact execution points where interactions cross slice boundaries.
Tessera models seams using the boundary symbol ∂. In this topology, the explicit payload or contract that threads across the boundary is known as the needle piece.
1. Internal Transitions (∂τ = ∅)
If a compute node c ∈ C_P reads and writes only to data stores owned by the same partition (R(τ) ∪ W(τ) ⊆ D_P), the transition is purely internal. It creates zero cross-boundary coupling.
2. Compute-to-Data Seams: Foreign-State Leaks
Foreign-state coupling occurs when compute owned by region P directly accesses data owned by foreign region Q:
(R(τ) ∪ W(τ)) ∩ D_Q ≠ ∅ (P ≠ Q)
This is the “Neighbor’s Fridge” Anti-Pattern: walking unannounced into your neighbor’s house and taking food directly from their refrigerator bypasses their authority and household rules. In software, directly updating another domain’s database table bypasses validation logic, locks rows unexpectedly, and prevents the target domain from evolving its schema.
3. Compute-to-Compute Seams: Contracted Pipeline Handoffs
When a journey requires coordination across slices, compute must talk to compute through a contracted boundary interface:
[Compute P] ---> [Typed Contract: Message ℰ] ---> [Compute Q]
The payload is the needle piece. Its contract must explicitly define:
- Field schemas and strict typing
- Idempotency guarantees
- Failure modes and compensatory rollback strategies
- Transport protocols (e.g., gRPC, HTTPS, SQS, transactional outbox)
Declarative Topology Specification
Because Tessera relies on discrete mathematical structures, an entire system architecture can be expressed as a declarative, machine-parseable schema (YAML or JSON).
The following snippet demonstrates a real-world seam between a legacy monolithic cart and a sovereign inventory slice:
version: "tessera/v1"
system_id: "ecommerce-core"
actors:
- id: "actor.customer"
kind: "user"
description: "Authenticated web customer"
slices:
- id: "slice.monolith"
name: "Legacy Monolithic Kernel"
- id: "slice.inventory"
name: "Sovereign Inventory Domain"
data_stores:
- id: "store.cart_items"
owner_slice: "slice.monolith"
kind: "sql_table"
- id: "store.stock_levels"
owner_slice: "slice.inventory"
kind: "sql_table"
compute_nodes:
- id: "node.cart_controller"
owner_slice: "slice.monolith"
runtime: "php-fpm"
- id: "node.stock_service"
owner_slice: "slice.inventory"
runtime: "go"
messages:
- id: "msg.add_to_basket"
kind: "http_request"
schema:
type: "object"
required: ["sku", "quantity"]
properties:
sku: { type: "string" }
quantity: { type: "integer", minimum: 1 }
- id: "msg.reserve_stock_command"
kind: "internal_command"
schema:
type: "object"
required: ["cart_id", "reservation_id", "sku", "quantity"]
properties:
cart_id: { type: "string" }
reservation_id: { type: "string" }
sku: { type: "string" }
quantity: { type: "integer", minimum: 1 }
- id: "msg.stock_reserved_event"
kind: "domain_event"
transitions:
- id: "step.record_cart_item"
inputs: ["actor.customer", "msg.add_to_basket"]
compute: "node.cart_controller"
outputs: ["store.cart_items", "msg.reserve_stock_command"]
- id: "step.reserve_inventory"
inputs: ["msg.reserve_stock_command", "store.stock_levels"]
compute: "node.stock_service"
outputs: ["store.stock_levels", "msg.stock_reserved_event"]
journeys:
- id: "journey.add_item_and_reserve"
name: "Add Item to Basket with Stock Reservation"
steps: ["step.record_cart_item", "step.reserve_inventory"]
contracts:
- id: "contract.inventory_reservation"
message: "msg.reserve_stock_command"
producer: "node.cart_controller"
consumer: "node.stock_service"
transport: "HTTPS"
endpoint: "POST /v1/reservations"
In this specification:
step.record_cart_itememitsmsg.reserve_stock_command.step.reserve_inventoryconsumesmsg.reserve_stock_command.- The causal intersection E_out(τ₁) ∩ E_in(τ₂) is proven.
- Each compute node accesses only its own sovereign data store.
Automated Seam Detection: The Architectural Compiler
Because the topology is declarative and mathematically defined, automated tooling can evaluate architectural rules deterministically in Continuous Integration pipelines.
The following Python function demonstrates how an automated validator mechanically identifies illegal foreign-state leaks across an entire system graph:
from typing import Dict, List, Set, Any
def detect_foreign_state_leaks(topology: Dict[str, Any]) -> List[Dict[str, str]]:
"""
Evaluates a Tessera system topology and identifies illegal foreign-state leaks
where a compute node directly accesses a data store owned by another slice.
"""
compute_owners: Dict[str, str] = {
node["id"]: node["owner_slice"]
for node in topology.get("compute_nodes", [])
}
data_owners: Dict[str, str] = {
store["id"]: store["owner_slice"]
for store in topology.get("data_stores", [])
}
leaks: List[Dict[str, str]] = []
for step in topology.get("transitions", []):
step_id: str = step["id"]
compute_id: str = step["compute"]
compute_owner: str = compute_owners.get(compute_id, "unknown")
inputs: List[str] = step.get("inputs", [])
outputs: List[str] = step.get("outputs", [])
# Extract all data stores referenced in inputs (reads) or outputs (writes)
referenced_elements: Set[str] = set(inputs) | set(outputs)
accessed_stores: Set[str] = referenced_elements & set(data_owners.keys())
for store_id in sorted(accessed_stores):
store_owner: str = data_owners[store_id]
if store_owner != compute_owner:
leaks.append({
"transition": step_id,
"compute_node": compute_id,
"compute_owner": compute_owner,
"illegal_data_store": store_id,
"data_owner": store_owner,
"leak_type": "READ" if store_id in inputs else "WRITE",
"rule": "RULE-TOPO-004: Direct foreign-state access is forbidden"
})
return leaks
The Compiler Analogy
In programming languages, a compiler takes abstract syntax, resolves symbol tables, and flags type errors before machine code is emitted.
Tessera acts as an architectural compiler:
- Syntax Errors: Unresolved references, broken identifier links, or overlapping primitive classifications.
- Type Errors: Compute nodes appearing in data inputs, or transitions lacking compute nodes.
- Semantic / Boundary Violations: Direct foreign-state bypasses, broken causal journeys, and missing interface contracts.
Architectural enforcement shifts from subjective pull-request reviews to automated, deterministic verification.
What Becomes Objective—and What Still Requires Judgment
Formally modeling an architecture establishes objectivity around specific structural questions:
- Does this transition touch a foreign data store? (Yes or No)
- Do adjacent journey steps share a valid message contract? (Yes or No)
- Does this service have exclusive ownership of its database tables? (Yes or No)
However, mathematics evaluates constraints; it does not make business trade-offs.
Mathematics cannot decide whether stock_levels belongs in an inventory slice or an order management slice. That choice depends on business organizational boundaries, team topology, latency requirements, consistency models, and transaction volumes.
Claims that formal topology creates “zero semantic drift” or “completely eliminates AI hallucination” are overstatements. What formal topology actually delivers is independent verifiability. When an AI agent proposes a refactoring or drafts a new feature, its proposal can be compiled and checked against declared structural invariants before a single line of production code is written.
From Systems Archaeology to Architectural Synthesis
The true power of formal software topology emerges when engineering teams combine autonomous AI agents with deterministic verification:
- Autonomous Archaeology: AI agents scan legacy ASTs, query logs, and database schemas to reconstruct the baseline topology of an undocumented monolith.
- Interactive Boundary Exploration: Human architects define strategic slices. AI models draft the transitions, seam boundaries, and contract definitions.
- Mechanical Verification: The architectural compiler validates that no state leaks exist and that all journeys maintain causal continuity.
- Target Synthesis: Once verified, the topology guides code generation, synthetic test harness creation, and automated boundary enforcement.
By giving AI agents an explicit, mathematical map of the system they must navigate, organizations eliminate the guesswork of legacy modernization. The map provides the coordinates; deterministic verification ensures the code never strays from the path.