negentropy
keep entropy down.
an agent-maintained codebase rots differently: every session reads the code with fresh eyes, prose comments drift unread, and each small compromise compounds quietly. negentropy turns that rot into a bill: a structural checker where every detected fault must be fixed, every debt stays visibly owed, and every unparsed region is named — so meaning moves out of prose and into structure, tests, and named vocabulary.
it works above the usual linter, not beside it: one shared parser applies the same structural laws across every language it reads — no target compilers, no target toolchains.
rust typescript tsx scss markdown
the loop
the premise, demonstrated. an agent wrote two violations in eight lines — a compound name and a block one idea too deep:
export function fetchAllData(rows: number[][][]): number {
let sum = 0;
for (const plane of rows) {
for (const row of plane) {
for (const cell of row) {
if (cell > 0) {
sum += cell;
}
}
}
}
return sum;
}$ negentropy --debt .
src/helper.ts:6:19 block depth over limit
src/helper.ts:1:17 debt fetchAllData
1 fault, 0 blindspots, 1 debt
by law: block=1 word=1
hot files: src/helper.ts=2
the checker billed it; the agent paid — not by clever chaining, but the way the law intends: extract the buried idea and name it. same algorithm, same passes, two flat shapes:
export function tally(rows: number[][][]): number {
let sum = 0;
for (const plane of rows) {
sum += gain(plane);
}
return sum;
}
function gain(plane: number[][]): number {
let sum = 0;
for (const row of plane) {
for (const cell of row) {
if (cell > 0) {
sum += cell;
}
}
}
return sum;
}$ negentropy --strict .
clean
every transcript on this page is a real run. this loop — write, judge, restructure, clean — is what the workshop is for. and when the compound is truly the industry's word, the other exit is honest too: register it with a rationale in vocabulary.toml, and let the dictionary delta ride the same PR.
[compound]
dataset = "the industry's own word; data-set reads worse"quickstart
curl -fsSL https://releases.negentropy.perish.uk/manage.sh | sh
negentropy --strict .manage.sh is a short, readable script: it installs the released binary under ~/.local/share and links it into ~/.local/bin — put that on PATH. linux x86_64 and macos (apple silicon) today— windows installs via manage.ps1 — and every artifact's sha256 sits beside it in checksums.txt. on an existing repo start with negentropy --debt . to list the tolerated debt; faults already fail, and --strict also makes blindspots fatal. laws and territories are declared per repo in negentropy.toml:
[scan]
include = ["src/**/*.ts"]
[module]
roots = ["src"]
[limit]
block = 4
path = 4
[comment]
allow = false
[word]
single = truewhere the law sits
an agent can read a document and still drift; only gates bind. the contract is one line — the actual first line an agent reads before touching this site's source — and three gates stand behind it:
# AGENTS.md
This repository is a constitution-era web workspace.
`negentropy --strict .` must print `clean` before anything lands.session
AGENTS.md names the constitution, so every session starts under it. the agent reads the bill as it works: negentropy --debt . is cheap enough to run after every edit.
commit
the pre-commit hook runs the full guard: a tree that is not clean cannot be committed, so no dirty change slips into history by accident.
merge
guard.yml runs the same gauntlet in CI, and the land flow merges only on green. one gate, three faces — session, commit, merge.
vocabulary
when a name wants two words, the agent restructures — or registers the compound with a rationale. the dictionary delta rides the same PR as the code that needed it.
the pieces
grammar first
a parser substrate with embedded g4 grammars delivers one uniform structure tree to language-agnostic checks. no target compilers, no target toolchains.
eleven laws
word, path, file, fanout, block, markup, comment, grant, dispatch, receiver, param — each declared in negentropy.toml and judged on every run of the scanned tree.
three classes
a fault fails the run, debt is reported and tolerated, and a blindspot is the scanner being honest about an unparsed region — fatal only under strict.
living vocabulary
single word only works against a living dictionary: agents maintain vocabulary deltas alongside code diffs, and registered compounds demand a rationale.