What it does
The monorepo holds every product in the ecosystem and the rules that every AI agent working on them must obey. It is where the products meet and where the governance lives.
The twelve products it holds
- The suite's data API: the data layer, a permanent identity and an append-only history for every property.
- The suite's Hub: the single sign-on gateway and the only issuer of sign-in tokens.
- Five web products: the owner portal for owners, plus products for professional inspections, field-service management and property management, and an internal administration dashboard.
- Five mobile apps: inspection and field-service apps for both iOS (Swift) and Android (Kotlin), and a property-management and tenant app in React Native.
Every product signs users in through Hub, reads and writes data only through the data API, and follows the same constitution. Nx enforces which project may depend on which, and Pact contract tests check that every consumer of the API agrees with what the API provides.
The ten-invariant constitution
Every product, in every language, follows ten rules, each enforced by a mechanism rather than by memory:
- Hub authentication only, no local logins.
- Data only through the API, never directly from a database (a hookify rule, Nx dependency limits and Pact contracts).
- UUIDv7 identifiers only (a hookify rule and an ast-grep rule).
- Time-zone-aware timestamps only.
- Observations are append-only; corrections supersede and deletes are soft (a hookify rule and a database trigger).
- WGS 84 coordinates only.
- Tests before code.
- Fail-closed security: deny by default, no empty catch blocks, no fallback credentials.
- The quality gate passes before every commit.
- Trunk-based development on the main branch.
The hookify rules
Hookify rules check what an agent is about to write or run and block it on the spot. The fourteen ecosystem rules block hardcoded secrets, skipping git hooks, skipping tests, UUIDv4, timestamps without time zones, dangerous shell commands, console.log in source, direct database access, deleting observations, the wrong coordinate system, fail-open fallbacks, empty catch blocks, feature branches and sorting without a comparator. The data API workspace adds 49 more and the documentation workspace two, 65 in all.
Lifecycle hooks and helper agents
- Eleven ecosystem hooks run at session start and stop, before and after tool calls, before context compaction and when a helper agent starts, plus six more in the documentation workspace.
- Four agent profiles, for API consumers, permission work, review and testing, are injected into helper agents automatically by matching the type of task. Each tells the agent which contract registries to read. The review agent has no write or edit access, so a reviewer can never quietly fix what it finds.
The contract registry and the MCP server
- Thirteen audited JSON registries hold the API's ground truth: permission levels, the controller pattern, error codes, rate limits, the response envelope, pagination, idempotency, versioning, layer boundaries, the base entity, domain events, ast-grep rules and the metrics baseline.
- The
contractsMCP server reads those registries and the API's source code and answers questions through fourteen tools: list endpoints, get an endpoint's detail, get permission levels, get the token structure, get error codes, get a response shape, get rate limits, get domain events, get an entity's schema, get a request's fields, validate an endpoint, validate a claim, search the source and list the registries. Before any agent writes a call to the API, it must confirm the endpoint exists; before it states how the API behaves, it must validate the claim.
Skills, gates and the build pipeline
- 23 skills across the three workspaces carry work through a fixed pipeline: specify, plan, break into tasks, audit, implement, review and report status.
- A six-gate implementation system: specification check, research, data-flow check, failing tests with proof they fail, implementation with proof they pass, and an audit by a fresh reviewer who did not see the work.
- A task state machine tracks each task through red, green and gate, and detects stuck tasks.
pnpm gateruns ast-grep, dependency-cruiser, coverage, type checks and tests; running tests alone never counts.
Analysis scripts
Eleven scripts measure the codebase and its discipline: a baseline capture of controllers, services, entities, events and lines; a deviation score from 0 to 100 that adds points for each pattern, hookify and layer violation; flaky-test detection and a quarantine manager; blame analysis that links a line of code to the session that wrote it; checkpoints for safe rollback; import-graph checks; and a test contract that every controller and service has a test file and coverage stays at 80 percent or more.
Stopping agents from making things up
- Ground-truth scan. Before writing about the API, documentation agents read all thirteen registries and build a fact registry. Every claim about the API needs a citation to code or a registry.
- Legacy capability scan. Nine registries list every capability of the legacy products. Every one must be given a disposition (carry forward, improve or remove), with 100 percent coverage, so no legacy feature is silently dropped.
- Stop gates and labels. Writing skills stop for confirmation after building their facts, and every claim is labeled current, target state or unverified.
The playbook and the memory
A 17-phase build playbook takes the ecosystem from market research through strategy, thirteen architecture phases and validation to product specifications. A four-layer memory (machine-local memory, in-repository observation logs, session state and session transcripts) carries lessons from one session to the next, and a hard-lessons registry records every costly mistake so it is never repeated.
What it achieved
- 11,600 files for twelve products under one set of rules.
- A 149,000-line API made machine-queryable through fourteen MCP tools, so agents check facts instead of guessing.
- 65 hookify rules, 17 shell hooks, 23 skills, 44 truth documents, 13 contract registries, 4 agent profiles, 11 analysis scripts, 3 state schemas and 6 specification templates in the governance harness, described in a 1,725-line technical report.
- A governance design grounded in measured failures: it answers each failure mode found in the project's own history.
The problem it solves
AI agents writing production code fail in ways people do not. Rules read at the start of a session fade as the context fills. A newly loaded skill overrides the project's rules. The commonest cause of bugs is the implementing agent ignoring documented patterns, not gaps in the specifications. Documentation written from a plan instead of from code contradicts itself and describes planned features as real. Without mechanical enforcement, quality erodes a little every session. The monorepo's harness answers each of these with something deterministic: a hook that blocks, a rule that fails the build, a registry that holds the facts and a server that answers from the source code.
How he built it
Maxwell built the governance before the products: the constitution, then the hooks and hookify rules that enforce it, then the contract registries and the MCP server that let agents check facts, then the skills and gates that carry every task from specification to audit. He directed AI agents to build every product inside that harness, kept implementation and review in separate agents, measured deviation with a scored script, and turned every expensive mistake into a written hard lesson and, where possible, a new blocking rule.