compass-ng keeps a model-driven code base consistent with its own models, documents and rules, fast enough to run on every edit. It reads a project’s org documents, models, C++ and SQL into memory once, then runs codecs over them. Codecs generate code, check rules and report what to fix. Its first client is ORE Studio, a large C++ code base developed mostly by LLM agents.
compass comes from the MASD Project. MASD, Model Assisted Software Development, is a methodology developed as part of a PhD programme and documented on the Dogen site. Its central claim is that the schematic, repetitive parts of a software system are projections of a small, language-neutral model, and that those projections can be reconstructed automatically.
MASD separates three concerns, each with its own metamodel:
- Logical space. The language-neutral concepts of the domain: entities, enumerations, relationships.
- Physical space. Where those concepts land as files: components, parts,
facets and archetypes, so every file has an address such as
cpp.include.types.class_header. - Variability. The configuration that decides which artefacts are produced and how they are named.
Dogen was the methodology’s first code generator. ORE Studio applies MASD with models written as org documents: entity, junction and field group models produce its C++, SQL, CMake and TypeScript through templates. compass is the tooling that keeps such a project honest. It regenerates every projection from the models, and checks that the code, the documents and the rules agree.
- Documents are data. Org documents, models and sources are parsed once
into data-oriented tables, not object graphs. The org parser matches
Emacs’s
org-elementon every one of ORE Studio’s 10,909 org files. - Parse nothing twice. Parsed data and codec results are stored by content hash in a store shared by every git worktree of a repository. A file one worktree has parsed is never parsed again by another.
- Run only what changed. Each codec records what it read. A run re-runs only the codecs whose inputs changed, and writes only the files whose content changed. Code generation is incremental per model and per template.
- One check, many rules. Gates that used to be separate scripts run as
codecs in a single
compass check. Each finding names its file, line, rule and fix. - Built for agents. The edit hook checks the file an agent just changed. Ratchet mode fails only on findings new since the merge base. Inline exceptions carry a reason, an approver and an expiry. Any past commit can be checked straight from git’s object store.
Measured on ORE Studio:
| Work | Before | With compass |
|---|---|---|
| Regenerate all code | minutes of Python, then formatting | 26,212 files, byte-identical; under 3 s warm |
| Run the ported gates | about half an hour of scripts | one compass check, about 4 s warm |
| Check one edited file | rerun the gates | about 0.2 to 0.9 s for most edits |
HTML export identical to Emacs, C++ and SQL analysis, and checks for the errors LLMs introduce are next. See the sprint in doc/agile/versions/v0/sprint_01.
Install a release. Each release carries an archive per platform
with its SHA-256 checksum: Linux x86_64 (glibc 2.38 or newer, as in
Ubuntu 24.04), macOS arm64, and Windows x64, which also has an installer.
On Linux and macOS the install script downloads the archive for the
machine, checks it and installs compass-ng:
curl -fsSL https://raw.githubusercontent.com/MASD-Project/compass/main/build/scripts/install_compass.sh \
| bash -s -- --release v0.0.1
compass-ng --versionA project that needs a given release names it on a release: line of a
pin file and installs it with --pin <file>.
Or build and test from source (the presets cap the build at two jobs):
cmake --preset linux-clang-release-ninja
cmake --build --preset linux-clang-release-ninja
ctest --preset linux-clang-release-ninjaInstall that build as the one shared compass-ng for every environment,
and see exactly which build it is:
build/scripts/install_compass.sh
compass-ng --versionA checkout configures compass with a .compass.org page at its root. Then:
compass-ng generate # write the outputs that changed
compass-ng diff # show what generate would change
compass-ng check # every enabled check, with each fix
compass-ng check --ratchet # only findings new since the merge base
compass-ng check --commit HEAD~3 # check a past commit without a checkoutThe recipes in doc/recipes/compass cover each command.
| Component | Holds |
|---|---|
compass.platform | Mapped files, processes, Python-compatible text and XML |
compass.testing | Test infrastructure: self-removing temporary directories, throwaway PostgreSQL clusters |
compass.store | Git index and object reading, the content-addressed store |
compass.org | Org tables and the document type registry |
compass.ingest | The org parser |
compass.db | compass’s PostgreSQL database, its schema and the corpus sync |
compass.codec | The codec runtime, records, caches, drift and the sink |
compass.model | The codegen model loader |
compass.codegen | Mustache rendering, render contexts, the codegen codec |
compass.cpp | C++ gates |
compass.sql | SQL gates and the DDL model |
compass.docs | Org document gates and document generators |
compass.crosscheck | Gates and generators that cross models, code and data |
compass.cli | The compass executable |
compass.bench | Measurement stages |
Each component’s modeling/component_overview.org describes it. Start with
doc/compass.org.
GNU GPL v3; see LICENSE.
