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
27 changes: 26 additions & 1 deletion .github/workflows/ocaml-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ on:
- 'examples/**'
- 'conformance/**'
- 'scripts/check-corpus.sh'
- 'scripts/check-rsr-instantiation.sh'
- 'QUICKSTART-*.adoc'
- 'Justfile'
- '.machine_readable/**'
- '.github/workflows/ocaml-ci.yml'
pull_request:
paths:
- 'compiler/**'
- 'examples/**'
- 'conformance/**'
- 'scripts/check-corpus.sh'
- 'scripts/check-rsr-instantiation.sh'
- 'QUICKSTART-*.adoc'
- 'Justfile'
- '.machine_readable/**'
- '.github/workflows/ocaml-ci.yml'
workflow_dispatch: {}

Expand All @@ -64,10 +72,15 @@ jobs:
run: |
set -euo pipefail
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends ocaml ocaml-dune menhir
# `just` is needed by the RSR guard's phantom-command check. Without
# it that half of the guard skips (loudly, but it still does not run)
# — which is how the QUICKSTARTs accumulated a dozen commands that
# were never recipes.
sudo apt-get install -y --no-install-recommends ocaml ocaml-dune menhir just
ocaml -version
dune --version
menhir --version
just --version

- name: Build
working-directory: compiler
Expand Down Expand Up @@ -108,6 +121,18 @@ jobs:
# sat failing its own assertions until TG-7 (#87) fixed `~`.
bash scripts/check-corpus.sh

- name: RSR instantiation guard
run: |
set -euo pipefail
# methodology.a2ml has always declared a reject-if-contains rule for
# template residue, and nothing enforced it — so four contractiles
# named the upstream template as their SUBJECT indefinitely. This
# makes the repo's own rule real. It also checks the docs only name
# `just` recipes that exist: the QUICKSTARTs documented nine that
# never did. (Deliberately worded without the literal tokens, so the
# guard need not allowlist its own caller.)
bash scripts/check-rsr-instantiation.sh

- name: TG-7 semantics guard
working-directory: compiler
run: |
Expand Down
16 changes: 13 additions & 3 deletions .machine_readable/bot_directives/methodology.a2ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,20 @@ perfective = 10 # % for SPDX headers, doc updates, formatting, style
# UNIQUE STRENGTH (when mode = divergent)
# ============================================================================
# What makes this project special. Agents should DEEPEN this, not broaden it.
# Customise this per project — the template default is generic.

[methodology.unique-strength]
description = "{{PROJECT_UNIQUE_STRENGTH}}"
description = """
Tangle's distinctive asset is that its central claim is MECHANISED rather
than asserted. Progress, Preservation, Determinism and Type Safety are
proven in Lean 4 over the same core the OCaml compiler implements, and the
two are tied together by translation validation (TG-3: 496 kernel-checked
obligations asserting OCaml infer_expr refines the Lean spec).

Since TG-7 (#50) the language's `==` decides braid-GROUP equivalence, so
"equivalence is isotopy" is executable rather than aspirational.

Deepen this, do not broaden it: the value is the proof-to-implementation
tie, and every claim carries an explicit trusted base (ASSUMPTIONS.md).
"""
deepen-not-broaden = true

# ============================================================================
Expand Down
4 changes: 2 additions & 2 deletions .machine_readable/contractiles/Adjustfile.a2ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: MPL-2.0
# Adjustfile — Drift-tolerance contract for rsr-template-repo
# Adjustfile — Drift-tolerance contract for tangle
# Author: Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
#
# Cumulative-drift catchment: tolerance bands + corrective actions.
Expand All @@ -8,7 +8,7 @@
# Fix with: adjust fix (applies deterministic patches; advisory otherwise)

@abstract:
Drift tolerances and corrective actions for rsr-template-repo. Unlike
Drift tolerances and corrective actions for tangle. Unlike
MUST (hard gate), ADJUST tracks cumulative drift against tolerance bands
and proposes corrective actions. Advisory — it warns and trends, it does
not block.
Expand Down
40 changes: 26 additions & 14 deletions .machine_readable/contractiles/Intentfile.a2ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: MPL-2.0
# Intentfile (A2ML Canonical) — north-star contractile for rsr-template-repo
# Intentfile (A2ML Canonical) — north-star contractile for tangle
# Author: Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
#
# Paired runner: intend.ncl
Expand All @@ -20,28 +20,40 @@
# contractile for hard gates.

@abstract:
North-star contractile for rsr-template-repo. This repository is the
canonical template for Rhodium Standard Repository compliance. It provides
the scaffold that all hyperpolymath repos should copy and customize.
North-star contractile for tangle — a research language in which programs
are structured as tangles (braids) and program equivalence is isotopy, not
syntactic equality. Ships an OCaml compiler, mechanised Lean 4 metatheory
(Progress / Preservation / Determinism / Type Safety), a Rust LSP and WASM
backend, and a conformance corpus.
@end

## Purpose

The rsr-template-repo serves as the master template for all hyperpolymath
repositories. It contains the complete set of contractile files, machine-readable
specifications, and governance documentation that define the Rhodium Standard.
tangle exists to make one claim precise and then hold itself to it:
computation is the construction of structured objects, and meaning is
preserved under valid transformation. Concretely that means equivalence is
decided by braid-group equality (TG-7, #50) rather than by comparing
representations, and that the core metatheory is machine-checked rather than
asserted.

Every new repository in the hyperpolymath estate should be initialized by
copying this template and substituting the placeholder values with
repo-specific content.
The proof ladder (TG-0..TG-10, see PROOF-NEEDS.md) is the spine: each rung is
either LANDED with a named artefact in proofs/Tangle.lean, or explicitly
recorded as research-grade. Claims that are trusted rather than proven are
registered in ASSUMPTIONS.md — currently A-TG-7.2, the correctness of the
Dehornoy decision procedure that `==` now depends on.

## Anti-Purpose

This repository is NOT:
- A general-purpose project scaffold for external use (hyperpolymath-only)
- A replacement for per-repo customization (all files must be bespoke)
- A static template that never changes (evolves with RSR spec)
- A runtime library or framework (build-time only)
- A backend for KRL. KRL is QuandleDB's resolution language; it neither
compiles to nor depends on tangle, and the `TangleIR` layer that was
supposed to connect them exists in no source file in either repo. See the
erratum in AFFIRMATION.adoc and the de-conflation in #78.
- A knot database. That is QuandleDB.
- A production language. It is a research vehicle; the readiness grade is
tracked honestly in READINESS.md.
- A proof of its own decision procedures. The metatheory is proven RELATIVE
to `braidEquiv`; see ASSUMPTIONS.md A-TG-7.2.

## If In Doubt

Expand Down
4 changes: 2 additions & 2 deletions .machine_readable/contractiles/Mustfile.a2ml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# SPDX-License-Identifier: MPL-2.0
# Mustfile — Physical state contract for rsr-template-repo
# Mustfile — Physical state contract for tangle
# Author: Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
#
# What MUST be true about this repository. Hard requirements.
# Run with: must check
# Fix with: must fix (where a deterministic fix exists)

@abstract:
Physical-state invariants for rsr-template-repo. This is the canonical
Physical-state invariants for tangle. This is the canonical
RSR template repository. These are hard requirements — CI and pre-commit
hooks fail if any check fails.
@end
Expand Down
6 changes: 3 additions & 3 deletions .machine_readable/contractiles/Trustfile.a2ml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SPDX-License-Identifier: MPL-2.0
# Trustfile — Trust boundaries and integrity invariants for rsr-template-repo
# Trustfile — Trust boundaries and integrity invariants for tangle
# Author: Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
#
# Defines what LLM/SLM agents are trusted to do without asking, and
# integrity invariants that verify the repo has not been tampered with.

@abstract:
Trust boundaries and integrity checks for rsr-template-repo. This file
Trust boundaries and integrity checks for tangle. This file
combines the trust-level definitions from the original TRUST.contractile
with the integrity invariants from the old Trustfile.a2ml. It defines
what AI agents may do autonomously and what requires human approval,
Expand All @@ -15,7 +15,7 @@ plus checks that verify repository integrity.

## Trust Levels

The rsr-template-repo operates at trust level: maximal
tangle operates at trust level: maximal

Trust levels:
- maximal: Agent may read, build, test, lint, format, heal freely.
Expand Down
71 changes: 71 additions & 0 deletions AFFIRMATION.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,74 @@ not the same claim in general: an `axiom` stub compiles cleanly while proving
nothing. Here they coincide, and that was checked rather than assumed.

The OCaml compiler remains unbuilt — no workflow in this repository builds it.

== Erratum — 2026-07-29

A second dated correction, appended under the same convention: the text above
is left intact, because an affirmation is a claim about a past state and
amending it in place would falsify a record.

=== Correction 3 — the template residue is cleared

The affirmation records as honest debt:

[quote]
5 `{{PLACEHOLDER}}` files + 8 `rsr-template-repo` references

Both counts were low, and the classification conflated two different things.
Re-measured 2026-07-29: *8* files matched `{{...}}` and *21* lines matched
`rsr-template-repo` — but most were *meta-references*, i.e. files describing
the debt rather than carrying it. Three are worth naming, because a naive
search-and-replace would have damaged them:

* `src/rust/src/eval.rs` — `"...add{{}} block"` is a Rust `format!` *escape*
(`{{}}` renders as a literal `{}`) describing the `add{}` language
construct. It is code, not a placeholder.
* `.machine_readable/bot_directives/methodology.a2ml` — the string appears
inside `reject-if-contains`, which exists precisely to *forbid* it.
* `AFFIRMATION.adoc` (this file) and `docs/identity-fabric/` — prose recording
the debt.

The *genuine* residue was: `{{DEPS}}`, `{{BUILD_OUTPUT_PATH}}`,
`{{PACKAGE_NAME}}` in `QUICKSTART-MAINTAINER.adoc`; `{{LANG_STACK}}`,
`{{BUILD_CMD}}`, `{{TEST_CMD}}`, `{{MUST_INVARIANTS}}` in
`QUICKSTART-DEV.adoc`; `{{PROJECT_UNIQUE_STRENGTH}}` in `methodology.a2ml`;
and four contractiles (`Intentfile`, `Trustfile`, `Mustfile`, `Adjustfile`)
plus `docs/CITATIONS.adoc` whose *subject was still rsr-template-repo* —
`Intentfile` asserted "This repository is the canonical template for Rhodium
Standard Repository compliance", and the citation guide credited
"Polymath, Hyper" for "RSR-template-repo". All are now instantiated for
tangle.

A worse class surfaced while fixing it: both QUICKSTARTs documented *commands
that do not exist* — `just build`, `just test`, `just lint`, `just panic-scan`,
`just setup-dev`, `just build-release`, `just install`, `just run`,
`just stapeln-export` — and asserted an `$XDG_CONFIG_HOME/tangle/config.toml`
that the compiler never reads. Documentation that fails when followed is worse
than none, so the recipe lists are now checked against `just --list` by
`scripts/check-rsr-instantiation.sh`.

=== Correction 4 — the OCaml compiler is no longer unbuilt

The closing line of the 2026-07-21 erratum reads:

[quote]
The OCaml compiler remains unbuilt — no workflow in this repository builds it.

That was true when written and is no longer. `.github/workflows/ocaml-ci.yml`
(added 2026-07-29, PR #87) builds the compiler and runs the full suite — over
4,000 assertions — on every relevant push and PR, and PR #89 added a gate over
the runnable corpus (`examples/` + `conformance/`).

That gate immediately earned itself: `examples/isotopy.tangle`, the program
whose purpose is to demonstrate the language's central claim, was *failing its
own assertions* and had been for as long as `~` used free reduction. It passes
only since TG-7 (#50/#87) made `~` decide real braid-group equivalence.

=== Correction 5 — `==` is no longer list equality

Anywhere the affirmation or its sources describe braid `==` as list equality:
that ceased to be true on 2026-07-29. Owner ruling #50 chose braid-*group*
equivalence, implemented in PR #87 across both engines. The metatheory is
proven *relative to* the decision procedure; its correctness is registered as
assumption *A-TG-7.2* and is not claimed as proven.
4 changes: 4 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,7 @@ corpus:
check-all:
@cd compiler && dune build && dune test --force
@bash scripts/check-corpus.sh

# Verify this repo is instantiated, not a copy of the RSR template
rsr-check:
@bash scripts/check-rsr-instantiation.sh
Loading
Loading