Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ Startup: confirm working directory and active task; run `deno task check` and re

Load docs on-demand when triggers fire; do not perform eager multi-spec reads at startup.

| Doc | Trigger |
| ------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `CONSTITUTION.md` | architecture changes, rule authoring, or design disputes |
| `CONSTITUTION-ARTICLES.md` | editing source files (pure core, types, boundaries, testing) |
| `docs/solutions/tooling/bash-to-deno-port-semantics.md` | modifying path mapping, git command wrappers, or cross-platform Deno CLI semantics |
| `subtrees.toml` | updating or adding vendored git subtrees |
| Doc | Trigger |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `CONSTITUTION.md` | architecture changes, rule authoring, or design disputes |
| `repos/constitution/ENFORCEMENT.md` | building or changing an instrument that grades work (lint gates, stream rules, CI checks, thresholds, rubrics, advisors); situational read only |
| `CONSTITUTION-ARTICLES.md` | editing source files (pure core, types, boundaries, testing) |
| `docs/solutions/tooling/bash-to-deno-port-semantics.md` | modifying path mapping, git command wrappers, or cross-platform Deno CLI semantics |
| `subtrees.toml` | updating or adding vendored git subtrees |

## Stack & Conventions

Expand Down
2 changes: 1 addition & 1 deletion repos/constitution/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
deno task test
deno task test && deno task test:validator
21 changes: 13 additions & 8 deletions repos/constitution/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AGENTS.md — Constitution Repository

Single source of truth for the supreme design law of [System F Software](https://systemfsoftware.com). Consumer repos vendor via `git subtree` + symlink. This repo has no production code, no test suite, and no build step — it is two documents plus governance tooling (corpus validation, commit validation): `CONSTITUTION.md`, the maker's law, resident in every agent's context, all articles, always; and `ENFORCEMENT.md`, the instrument owner's doctrine, never loaded into the maker's context.
Single source of truth for the supreme design law of [System F Software](https://systemfsoftware.com). Consumer repos vendor via `git subtree` + symlink. This repo has no production code, no test suite, and no build step — it is two documents plus governance tooling (corpus validation, commit validation): `CONSTITUTION.md`, the maker's law, resident in every agent's context, every law, always; and `ENFORCEMENT.md`, the instrument owner's doctrine, never loaded into the maker's context.

@CONSTITUTION.md

Expand All @@ -25,20 +25,23 @@ Before making changes:

### Corpus

- **`CONSTITUTION.md` (Resident):** the entire maker corpus — the Application section plus Articles I–V — loaded in every session. There is no retrieved half and no on-demand trigger: law that is not in the window is not law. Residency delivers obligation, not enforcement; the machinery of judgment lives outside the maker's reach.
- **`CONSTITUTION.md` (Resident):** the entire maker corpus — a one-line preamble and the laws in four sections (Model the domain, Shape the code, Prove it, Finish) — loaded in every session. There is no retrieved half and no on-demand trigger: law that is not in the window is not law. Residency delivers obligation, not enforcement; the machinery of judgment lives outside the maker's reach.
- **`ENFORCEMENT.md` (Non-resident):** the instrument owner's doctrine — gate design, instrument-change discipline, enrollment law. Read by whoever builds or changes a gate, never `@`-imported into a maker's context. Consumer repos route to it from the leaves that own enforcement surfaces (lint plugins, guard scripts, CI workflows, rules directories, advisor rosters): one line — "You are editing an enforcement instrument. Read the vendored `ENFORCEMENT.md` before this lands." A routing line added anywhere else is the defect: the maker must not meet instrument doctrine while doing graded work.
- **`docs/solutions/`:** past problems and their fixes, organized by category with YAML frontmatter (`module`, `tags`, `problem_type`); `CONCEPTS.md` at repo root holds shared domain vocabulary.

### Writing a Rule

Rules are fenced YAML blocks with: `id`, `title`, `gate`, `do`, `dont`, `harm`, `check` (and optional `example`, `scope`, `layers`).
Laws are fenced YAML sequences, one block per section of `CONSTITUTION.md`. Each item has exactly `id`, `law` (one sentence addressed to you), `why` (the harm), and `example` with exactly `wrong` and `right`. The whole file stays within 1,800 words (`wc -w`). `deno task test` fails on a missing or extra field and on the word budget.

Each law has exactly one entry in the `## Corpus` block of `ENFORCEMENT.md`: `law`, `handle`, `absorbs`, `checks` (each a `question` with its `criteria`), `mechanism` (type, command, refusal, review), `severity`, `waiver`, and at least two `incidents` — failures from public history, each a commit, path and line. The corpus also holds the `judging` rules and the `retired` ids. `deno task test` fails on a law without exactly one entry, a duplicate handle, fewer than two incidents, or a citation that resolves to no live, judging or absorbed id; whether each incident is a real failure is review.

### Minting an ID

ID format: `CONST-<family><n>`. Pick the next free number in the family (never renumber to close gaps).

| Letter | Family | Purpose |
|---|---|---|
| `G` | Governance | Invoking constitution or resolving priority |
| `G` | Governance | Judging rules in the `ENFORCEMENT.md` corpus: verdict severity, reading by purpose, supremacy |
| `E` | Enforcement | The maker's conduct under judgment (evidence, the instrument boundary); instrument design lives in `ENFORCEMENT.md` |
| `P` | Purity | Decision functions and side-effect isolation |
| `D` | Domain modelling | Domain types and constraints |
Expand All @@ -50,8 +53,10 @@ ID format: `CONST-<family><n>`. Pick the next free number in the family (never r

### Changing a Rule

- Same obligation reworded / moved: **keep ID**.
- Obligation narrowed, widened, split, or deleted: **retire old ID forever** and mint new one.
- Same obligation reworded or moved: **keep the id and its handle**.
- Obligations merged: the survivor keeps the lowest surviving id; the others go to its entry's `absorbs:`.
- Obligation removed: the id goes to `retired:` with its reason. Obligation narrowed, widened, or split: mint a new id.
- Handles are frozen once landed, and an absorbed or retired id is never reused: `deno task test --against <rev>` fails a changed handle and an absorbed or retired id that returns as live. Whether a change is a rewording or a changed obligation is review.
## Surface Classes

| Surface | Files | Rule |
Expand All @@ -73,11 +78,11 @@ A task is done only when ALL of the following are true:
## Verification Commands

```bash
deno task test # one file: schema, coverage, ids, families, dangling citations
deno task test # two files: law schema, word budget, corpus entries, handles, ids, families, dangling citations
deno run --allow-read --allow-env --allow-run npm:@commitlint/cli@21 --from HEAD~1
```

After a commit that deletes, splits, merges, or re-scopes a rule — not after every edit — also run the reassignment check against the revision before it:
After a commit that deletes, splits, merges, or re-scopes a rule — not after every edit — also run the lineage check against the revision before it:

```bash
deno task test --against <rev>
Expand Down
6 changes: 3 additions & 3 deletions repos/constitution/CONCEPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Shared domain vocabulary for this project — entities, named processes, and sta
The complete set of law documents the repository ships, treated as one unit. The corpus is what the gate certifies and what agents are bound by — not any single file's contents. Shrinking the measured portion of the corpus is a defect, not an optimization.

### Rule
One fenced YAML block inside the constitution carrying an id of the form `CONST-<family><number>` — the family letter is one of G, E, P, D, B, T, N, W, S (governance, enforcement, purity, domain modelling, boundary, testing, naming & structure, work discipline, subtraction). A rule is the atomic unit of law: it is minted with a fresh number, amended in place, or vacated. Minting takes the next free number in the family — a minting law enforced by review, not by the gate. A vacated number is never reused for new law.
One law in `CONSTITUTION.md`, carrying an id of the form `CONST-<family><number>` — the family letter is one of G, E, P, D, B, T, N, W, S (governance, enforcement, purity, domain modelling, boundary, testing, naming & structure, work discipline, subtraction) — a one-sentence `law`, its harm in `why`, and a wrong/right `example`, with exactly one entry in the `ENFORCEMENT.md` corpus holding its frozen handle, checks, mechanism, severity, waiver and failure incidents. A rule is the atomic unit of law. A law whose obligation survives keeps its id even when merged: it takes the lowest surviving id, and the others go to its entry's `absorbs:`. A removed obligation goes to `retired:` with its reason, and a changed obligation takes a new id. Minting takes the next free number in the family — a minting law enforced by review, not by the gate. An absorbed or retired number is never reused for new law.


### Vacuous pass
A gate exiting green because it measured less than it claims — a missing input, an input that contributes nothing, a comparison arm that reads only part of the history. The output shape is identical to a healthy run, so the green actively certifies the absence of defects it did not look for. The doctrine this repo's gate is built on: assert the corpus, not only the contents; a gate that cannot fail is a certificate, not enforcement.

### Residency
The delivery contract for the maker's law: whatever must bind the agent's choices is always present in its context window, with no retrieval step. The counter-design — a thin resident pointer plus retrieved full text — forces presence at fetch time but never conformance at use time. Residency delivers obligation, not enforcement: the window tells the maker what is required, and whether the requirement held is decided afterward by instruments the maker cannot edit (ENFORCEMENT.md). What cannot fit residency is reference material and instrument doctrine, not law.
The delivery contract for the maker's law: whatever must bind the agent's choices is always present in its context window, with no retrieval step. The counter-design — a thin resident pointer plus retrieved full text — forces presence at fetch time but never conformance at use time. Residency delivers obligation, not enforcement: the window tells the maker what is required, and whether the requirement held is decided afterward by instruments the maker cannot edit. What cannot fit residency is reference material and instrument doctrine, not law.

### Corpus gate
The single check that certifies the constitution corpus — schema of every rule block, id and family registry, citation integrity across the corpus, and cross-revision comparison on demand. It runs as the repository's test command and again at every commit through the pre-commit hook, which makes any corpus-shape change also a gate change: the gate certifies the very input set a restructure edits.
The single check that certifies the constitution corpus — schema of every law and corpus entry, the word budget, id and family registry, handle uniqueness, citation integrity across both files, and, on demand, lineage against an earlier revision: every id there is live, absorbed, a judging rule, or retired. It runs as the repository's test command and again at every commit through the pre-commit hook, which makes any corpus-shape change also a gate change: the gate certifies the very input set a restructure edits.
Loading
Loading