Canonical location: this file at the repository root is the single source of truth for Trinity constitutional law. docs/nona-03-manifest/SOUL.md is an expanded reference (detail, examples); if anything disagrees, this file wins.
** Immutable Document — Amendments Require Unanimous Architectural Consent **
"A specification without tests is a lie told in the future tense." — Trinity TDD Axiom #1
T27 is a spec-first architecture where mathematical truth, not implementation, is the source of truth. This document establishes the constitutional principles that govern all T27 specifications, compilation, and verification.
Source files MUST be ASCII-only. Identifiers and comments MUST be English.
All files in the following categories MUST contain only ASCII characters (U+0000–U+007F):
.t27— TRI-27 assembly specifications.tri— TRI high-level specifications.zig— Zig source code.c/.h— C source/header files.v/.verilog— Verilog hardware descriptions- Build scripts, makefiles, etc.
FORBIDDEN in source files:
- Cyrillic (U+0400–U+04FF) and other non-Latin scripts in identifiers and comments
- Non-Latin scripts: Greek, Arabic, Chinese, Japanese, Korean, etc., unless an Architect-approved exception exists
Markdown under docs/, specs/, architecture/, conformance/, and root project Markdown (README.md, AGENTS.md, CLAUDE.md, TASK.md) MUST be English, except paths listed in docs/.legacy-non-english-docs (grandfathered) and anything under external/.
The parser rejects Cyrillic in source with:
error: Language policy violation: source file contains Cyrillic characters (U+0400-U+04FF). Source files must be ASCII-only. See SOUL.md Article I.
CI runs scripts/check-first-party-doc-language.sh on pull requests.
Compiler build: cargo build in bootstrap/ runs build.rs, which fails the build if Cyrillic appears in specs, bootstrap Rust sources, or unlisted first-party Markdown (this Article; expanded enforcement notes in docs/nona-03-manifest/SOUL.md Law #1).
- Universality: ASCII is universally supported across all platforms and tools
- Clarity: English is the single review language for Trinity first-party docs and specs
- Separation of Concerns: Vendored locales live under
external/; core repo stays English - Git Compatibility: No encoding issues in diffs, patches, or blame output
Every .t27 specification MUST contain at least one of:
- A
.testsection with one or more test cases - An
.invariantsection with one or more invariant declarations - A
.benchsection with one or more benchmark declarations
No exceptions. A spec without tests is not a specification—it is a draft.
.test
; test_bind_unbind_identity
; Verify: bind and unbind are inverses for all trits
; Setup: create vector a, bind with b, unbind with b
; Expected: result == a
; test_bundle_idempotence
; Verify: bundling a vector with itself produces same vector
; Setup: create vector v, bundle v with v
; Expected: result == v
.invariant
; no_trit_overflow
; All trit operations stay within {-1, 0, +1}
; Rationale: Balanced ternary requires strict bounds
; similarity_non_negative
; For all vectors a, b: similarity(a, b) >= 0
; Rationale: Similarity is a distance metric variant
.bench
; bench_bind_latency_cycles
; Measure: cycles for single bind operation
; Target: < 50 cycles on typical hardware
spec vsa_ops {
test bind_unbind_identity {
given a = vector_random(27)
given b = vector_random(27)
when bound = bind(a, b)
when result = unbind(bound, b)
then result == a
}
invariant no_trit_overflow {
assert forall v: vector, all_trits_in_range(v, -1, 1)
}
rule similarity_bounds {
expect forall a, b: 0 <= similarity(a, b) <= 1
}
}
Implementation status (verified 2026-08-09, Wave Loop 557). The example above —
test name { given ... when ... then ... }— does not parse.t27c parserejects it with "unexpected token after expression statement" at the firstgiven. The brace body is parsed as a function body, andgiven/when/thenare not statements there.The braceless variant shown in
docs/nona-03-manifest/TDD-CONTRACT.mddoes parse, but its body is discarded:parse_test_blockcallsskip_to_next_top_level()for the keyword form, so codegen emits an empty test. A spec asserting2 == 999compiles totest "..." {}and passes. Repo-wide this affects 7,623 test blocks and, via the same path inparse_invariant_block, 5,163 invariants (which emit// invariant: X verified (no statements)).Neither form currently executes. See
docs/reports/WAVE_LOOP_555_REPORT.md. Until this is resolved, use brace-form tests with ordinaryassertstatements — the form the backends do emit.
T27 does not have a prototype mode. There is no --allow-no-tests flag. There is no "I'll add tests later" grace period.
If you write a spec without tests, the parser will reject it with:
TDD contract violated: spec must contain at least one 'test' or 'invariant' block
Tests written after implementation are not tests—they are retroactive justification. True TDD requires the test to exist before the implementation, serving as:
- A contract between specifier and implementer
- Executable documentation
- A guard against regression
- A design tool (the test tells you what the API should be)
The parser (compiler/parser/parser.t27) MUST call validate_spec() after parsing. This function:
- Checks for presence of test_section, invariant_section, or bench_section
- Checks spec_decl.test_blocks or spec_decl.invariants for spec-style
- Emits a hard error ("TDD contract violated") if none exist
All code generators MUST emit test code:
- Zig:
test "test_name" {}andtest "invariant_name" {} - C:
void test_name(void)andvoid invariant_name(void) - Verilog:
task test_name();andassert (property)
Generated tests MUST be executed at build time:
- Zig:
zig testruns automatically in build.tri - C: tests compiled into test binary and run
- Verilog: assertions verified in simulation
This constitution may be amended by:
- Opening an ADR (Architectural Decision Record)
- Documenting the proposed change with full rationale
- Obtaining unanimous consent from all architectural stewards
The following are immutable and may never be changed:
- The Language Policy (Article I)
- The TDD Mandate (Article II)
- The Ban on Prototype Mode (Article III)
- The Validation Requirements (Article IV)
All AI agents working on T27 MUST:
- Check for test/invariant/bench sections before creating new specs
- Reject specs without tests with a hard error
- Add test blocks when retrofiting existing code
- Never bypass or disable validation
Human contributors MUST:
- Review test coverage in every PR
- Request tests for any spec lacking them
- Treat test failures as blocking issues
The CI/CD pipeline MUST:
- Run all generated tests on every commit
- Block PRs where any test fails
- Block PRs where any spec lacks tests
T27 rests on three pillars. Violating any violates the whole:
- φ² + 1/φ² = 3 — The mathematical foundation
- Ternary Computation — The computational substrate
- TDD-Inside-Spec — The verification mechanism
Additionally, the Language Policy (Article I) ensures universality and clarity.
No new Bourne-shell (*.sh) scripts for validation, code generation, conformance, or data processing on the engineering critical path. Shell lacks static types, robust error semantics, and unit-test culture; it conflicts with compiler-as-SSOT and tool-qualification discipline (deterministic, reviewable tooling).
scripts/tri— an exec-only shim (on the order of ≤20 lines): resolvet27c, pass--repo-root, thenexec. No routing, nocaseladders — batch directory generation ist27c gen-dir(Rust). OptionalTRI_T27Coverride for CI or custom paths.scripts/setup-git-hooks.sh— one-time local bootstrap (core.hooksPath), kept small (on the order of tens of lines).
- All validation, conformance gates, doc language checks, and φ binary64 cross-checks live in
t27c(Rust) —lint-docs,validate-phi,suite,validate-conformance, etc. - Python is not permitted on the engineering critical path; legacy scripts are removed once a
t27csubcommand exists. - CI invokes
./scripts/tri <subcommand>ortarget/release/t27c --repo-root . <subcommand>— not ad-hoc.shwrappers.
Aligns the repository with TDD-MANDATE and SSOT-MATH: behavior lives in specs + compiler, not in untested bash. Reduces macOS/Linux drift (realpath, find, readlink) and quoting/glob hazards. A single TCB for tooling (rustc + t27c) supports tool-qualification discipline (e.g. DO-330-style narratives).
| Command | Action |
|---|---|
tri validate <spec> |
Check spec has tests (enforced by parser) |
tri gen <spec> |
Generate code with tests embedded |
tri test <spec> |
Run generated tests |
tri soul |
Display this document |
Enacted: 2026-04-04
Version: 1.2 (Article VIII NO-PYTHON / NO-SHELL — 2026-04-06)
Status: Immutable core (Articles I–IV per Article V); Article VIII may be refined by ADR + steward consent