Skip to content
Maxwell CollinsContact

Shared home and AI rulebook for twelve property products

The shared home and rulebook for twelve property products, where AI agents write the code under machine-checked rules.

What it achieved

Lets AI agents build a whole family of property products, stopping any known mistake as it is written.

The short version

AI agents build a whole family of twelve property-technology products here, and any known mistake is stopped the moment an agent writes it; all twelve share one sign-on, one data API and one rulebook. This is their shared home (a monorepo): the data API, the sign-on gateway, five web products and five mobile apps. Ten founding rules (the constitution) govern every product in every language. 65 automatic rules block known mistakes on the spot. When an agent needs a fact about the API, it asks a fact service that answers from the source code. Thirteen audited fact files hold the API's ground truth. Six checkpoints take each piece of work from written plan to finished code, ending with a fresh reviewer.

The problem

AI agents writing production code fail in ways people do not. Rules read at the start of a session fade as it goes on. The commonest cause of their bugs is ignoring documented patterns, not gaps in the specifications, and documentation written from a plan rather than from the code describes planned features as real.

In use

  1. Every product signs users in through the gateway and reads and writes data only through the API, under the same constitution.
  2. When an agent needs a fact about the API, it asks the fact server, which answers from the source code.
  3. A mistake the project has seen before is blocked at the moment the agent tries to write it.
  4. Six gates take each piece of work from specification to merge, and a tracker moves each task from failing test to passing test to gate.

What it achieved

  • The commonest cause of AI bugs, an agent ignoring documented patterns, is blocked at the source: each kind of mistake in the project's own history has a machine check that stops it as it is written, 65 blocking rules in all.
  • Twelve products run under one set of rules, so a lesson learned in one protects them all, with sign-on, data access and the contracts between them checked by machine.
  • Agents check facts instead of guessing: the 149,000-line API answers their questions through 14 tools, straight from its source code.
  • Anyone picking up the work can learn the whole design from one 1,725-line technical report.

The full record

On this page
In one sentence

Maxwell built the twelve-product ecosystem monorepo, the shared home of 11,600 files for a property-technology ecosystem of one data API, one sign-on gateway, five web products and five mobile apps, with an AI-governance harness built in: a ten-invariant constitution, fourteen ecosystem hookify rules (65 across its three workspaces), eleven lifecycle hooks, a contract registry of 13 audited files, and a fourteen-tool MCP server that makes a 149,000-line API machine-queryable so no agent has to guess how it works, across 198 commits. He builds by directing AI agents, and he built this system that way.

files
11,600
hookify rules
65
MCP tools
14
API lines made queryable
149,000

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:

  1. Hub authentication only, no local logins.
  2. Data only through the API, never directly from a database (a hookify rule, Nx dependency limits and Pact contracts).
  3. UUIDv7 identifiers only (a hookify rule and an ast-grep rule).
  4. Time-zone-aware timestamps only.
  5. Observations are append-only; corrections supersede and deletes are soft (a hookify rule and a database trigger).
  6. WGS 84 coordinates only.
  7. Tests before code.
  8. Fail-closed security: deny by default, no empty catch blocks, no fallback credentials.
  9. The quality gate passes before every commit.
  10. 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 contracts MCP 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 gate runs 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.