Lattice (latt) checks and queries the records a repository keeps in its own files
(requirements, specs, tests, issues) and the links between them. It reads them where
they live, in the format they already use: an adapter for each format turns the
files into records and links, and a YAML profile declares which kinds of record
exist, what their IDs look like and which rules to check.
It reports dangling references, requirements with no recorded test link, invalid attributes and rows it could not read, each at its file and line. Developers, AI agents and CI jobs run the same check as the files change and get the same answer.
Use Lattice when records span many files, when rows hold syntax a text search misreads (a commented-out row, a template row in a code block, an ID named in prose), or when the same check runs on every commit. For a small register and a one-off question, reading the files may be quicker. A missing test link means the register records none; whether a test exists elsewhere, or passes, lies outside what Lattice reads.
Three design rules hold throughout:
- Your files stay the authority. Lattice reads them afresh each run and stores nothing; edits go through your editor or the register's own tool.
- Your vocabulary lives in the profile. A new vocabulary needs a profile, no code.
- Unreadable input is reported. An unparsable row becomes a
PARSE_ERRORat its line. A profile may suppress the finding; the run still says its input was partial.
The profile's adapter: block picks the adapter and tells it where to look. The adapter
hands the core a JSON document of records and links, with a finding for anything it
could not read. The core builds the graph from that document and checks it against the
profile, the same way for every format and register. A new format needs a new adapter,
and leaves the core alone.
| Interface | For | What you get | Start with |
|---|---|---|---|
latt CLI |
people at a terminal, CI jobs, scripts and AI agents | findings with file and line, queries, a three-valued exit code, and --format json |
cli.md |
latt browse TUI |
people exploring a register | the graph in the terminal: follow edges, jump from a finding to its row, hand a node to your editor | browse.md |
latt-core library |
Rust applications that hold a register in memory | the same validation and queries as a function call, with no file or network I/O | embedding.md |
For agents. An agent drives the CLI like a script does, and reads the exit code
first: 0 no error-severity findings (warnings may still print), 1 error-severity
findings, 2 Lattice could not run. --format json is the output whose shape is a
public surface, and json.md lists every key. A release install carries
the documentation beside the binary, so an agent can read it there. Three files prime an
agent before it starts:
AGENTS.mdpoints an agent at the skills, the core docs and the rules for using Lattice.skills/latt/is an agent skill for checks and queries: the commands, what each exit code means and how to read a finding.skills/latt-author/is an agent skill for writing a profile and, for a format no shipped adapter reads, an adapter.
Copy either directory into your agent's skills directory (for Claude Code,
~/.claude/skills/).
In CI. A job or hook runs the same latt validate line you run by hand, and decides
on the exit code (cli.md). ci.md has a recipe for
each way to gate:
- a pre-commit hook and a GitLab CI job that stop only when Lattice cannot run;
- error and strict gates, a JSON check, a merge-request report, and a profile test that pins your profile's findings on a fixture register.
Adapters. One for each format; these ship with Lattice:
| Register | Adapter |
|---|---|
| Markdown tables | md (built in) |
| TOML array-of-tables | toml (built in) |
§ cross-references in prose |
prose-xref (built in) |
| entomologist issues | entomologist |
| OpenSpec specs and the tests that cite them | openspec (Python) |
For any other format, you can write an adapter: a program in any language that prints one JSON document (adapters.md).
Validation. A YAML profile declares the node kinds, their ID patterns and attrs, and
which kinds may point at which. latt validate reports:
- broken structure: a dangling reference (
VACANCY), an ID of the wrong shape, an edge between kinds that may not be linked; - gaps in traceability: a requirement no test verifies (
COVERAGE), a node nothing points at or that points at nothing; - bad data: a missing or mistyped attr, a value outside its enum, a failed cross-field rule;
- unreadable input: a malformed row or file, reported at its line as
PARSE_ERROR.
Each finding has a default severity; your profile can change it, short of promoting a hint.
Queries. latt query finds what a node reaches, the path between two
nodes, the orphans, the counts, or what changed between two git revisions. latt fuse
checks references across registers in several repositories.
The v0.8.1 release has Linux
binaries for x86_64 and aarch64 that require glibc 2.28 or later, such as Debian 10 and
RHEL 8. On musl systems such as Alpine, build from a checkout as below. A release
carries latt and the latt-adapter-<name> programs as single binaries, one set per
architecture, and GitHub's source archive of the tag, which holds profiles/,
adapters/ and docs/.
- Unpack the source archive.
- Check the downloaded binaries against the release's
SHA256SUMSbefore renaming them:sha256sum -c --ignore-missing SHA256SUMS. - Put your architecture's binaries in a
bin/besideprofiles/, namedlattandlatt-adapter-<name>without the architecture suffix, and make them executable (chmod +x bin/*); a download arrives without the executable bit. - Put that
bin/on your PATH.
That directory is a release install. The openspec adapter also needs Python 3.12 or
later, newer than the python3 that RHEL 8 ships.
To build from a checkout, install rustup; the first cargo command
fetches the pinned toolchain. Then:
cargo install --locked --path crates/lattThis puts latt and latt-adapter-entomologist in ~/.cargo/bin. The md, toml and
prose-xref adapters are built into latt. The entomologist adapter runs git, which
must be on your PATH.
The Python programs, the openspec adapter and the latt-suggest sidecar, need Python
3.12 or later. They stay in adapters/ and run with python3; name them by path, as in
--adapter /path/to/lattice/adapters/openspec.
Lattice's own repository is a register: its specs state requirements in
### Requirement: headings, and its tests cite the requirement they verify in a comment
such as // Requirement: cli/Exit codes. With latt on your PATH, and Python 3.12 or
later for the openspec adapter, clone the release and validate it:
git clone --branch v0.8.1 https://github.com/jonelay/lattice
cd lattice
latt validate --profile profiles/openspec.yaml --adapter adapters/openspec --target . --format plainThe profile, profiles/openspec.yaml, asks for a verifies edge into every requirement.
Each requirement without one prints as a COVERAGE hint at its spec line. Hints show on
every run and gate nothing, so the run exits 0. A last line on stderr says what the run
read: how many files, and the nodes and edges of each kind.
Ask which tests verify a requirement:
latt query reached-by 'cli/Exit codes' --edge-kind verifies \
--profile profiles/openspec.yaml --adapter adapters/openspec --target .latt browse with the same --profile, --adapter and --target opens the register:
follow an edge from a requirement to its tests, or jump from a finding to its line.
To describe a register of yours, profiles.md starts with a profile for a Markdown table.
| Command | Answers |
|---|---|
describe |
What does the profile declare, and what did the adapter read under it? |
validate |
Where does the register break the profile's rules? |
trace |
Every node, with its edges and findings |
summary |
How many nodes are in each status? |
coverage |
How many nodes of each kind have links? --rule N checks one configured rule |
query |
Reachability, paths, orphans, counts, a file's declarations, a diff between revisions |
fuse |
Do the references between several registers resolve? |
browse |
Interactive navigation of nodes, edges and findings |
show |
What profile document does the adapter receive? |
adapter |
What does a built-in adapter produce? |
Every command takes --help. cli.md owns the details: flags, output
formats and exit codes.
| Page | Contents |
|---|---|
| cli.md | Commands, output formats and exit codes |
| profiles.md | A first profile, then the schema: kinds, IDs, edges, validations |
| adapters.md | Each shipped adapter's configuration, and writing your own |
| browse.md | The terminal browser: views, keys and actions |
| ci.md | Pre-commit hook and CI job recipes |
| json.md | Every key of each command's --format json output |
| fuse.md | References across several registers |
| embedding.md | The Rust library interface |
| glossary.md | Terms the docs use |
| references.md | Published methods Lattice follows |
| CHANGELOG.md | Changes per release, with migration notes |
To work on Lattice itself, see CONTRIBUTING.md.
Licensed under either of the Apache License, Version 2.0 or the MIT license, at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
