Session 9 — First Native Binary & NCI Integration¶
Date: April 2026
Status: Complete ✅
What We Built¶
Phase 2.5 — First Native Binary ✅¶
Installed GCC via MSYS2 on Windows and compiled output.c to a native binary — the first ever native Terse program.
# Install GCC via MSYS2 MINGW64 terminal
pacman -Syu
pacman -S mingw-w64-x86_64-gcc
# Compile
cd src/transpiler
gcc output.c -o hello -I. -Wall
# Run
./hello.exe
# Output: dog is mammal: 1
The inference engine ran as compiled machine code. Not Python. Not an interpreter. A native Windows binary that correctly derived dog is mammal from dog has fur and the rule when has fur then is mammal.
Phase 2.5 complete.
Parser Bug Fix — with reason: Stray Output ✅¶
Fixed a cosmetic bug where with reason: "some text" in ethics deny statements produced stray relationship output: linked: with -> reason -> :.
Root cause: with and reason were not in the KEYWORDS set in lexer.py. The lexer tokenized them as identifiers, and the relationship handler in parse_statement() treated with reason : as a three-word relationship before the ethics parser could consume them.
Fix: Added with and reason to KEYWORDS in lexer.py.
# Before
'fill', 'dot', 'shape', 'zeros', 'ones', 'sealed'
# After
'fill', 'dot', 'shape', 'zeros', 'ones', 'sealed', 'with', 'reason'
Important for NCI: The lib/terse/ copy in NCI must be this version or later. Earlier versions have the stray output bug.
Sealed Block Signature Bug Fix ✅¶
Fixed a bug where sealed blocks always failed verification with "has no registered signature".
Root cause: seal.py prints "Paste this into your project" but the SEALED_SIGNATURES constant was never actually added to interpreter.py. The __init__ method initialized self.sealed_signatures = {} — an empty dict — so verify_sealed_block immediately raised because "ethics_core" not in {}.
Fix: Added SEALED_SIGNATURES as a module-level constant in interpreter.py and changed __init__ to use it instead of an empty dict.
Stage 1 — Terse/NCI Integration ✅¶
The Terse interpreter is now a live dependency of NCI running in production on Oracle.
What was built:
lib/terse/created in NCI — lexer, parser, interpreter, errors copied interse_loader.py— reads a.trsfile, extracts deny rules, returns[(keyword, reason)]rules/ethics_rules.trs— 5 production ethics rules written in TerseSafetyProfileinethics.pygainsblock_reasons: dict— Oracle now explains why it refused, using the reason string from the.trsfile- Deployed to Oracle, rehashed, confirmed healthy with 5 rules in startup logs
The rules file:
ethics rule no_manipulation
when intent is manipulation
then deny with reason: "Absolute limit"
ethics rule no_exploitation
when intent is exploitation
then deny with reason: "Absolute limit"
ethics rule no_coercion
when intent is coercion
then deny with reason: "Absolute limit"
ethics rule no_surveillance
when intent is surveillance
when consent is absent
then deny with reason: "Absolute limit"
ethics rule no_deception
when intent is deception
when target is vulnerable
then deny with reason: "Absolute limit"
Confirmed working: A Terse rule fired in production at confidence 1.0 with the exact reason string from the .trs file.
Design Decisions Made This Session¶
withandreasonare now keywords — prevents relationship handler from consuming them before the ethics parserSEALED_SIGNATURESmust be explicitly populated — seal.py generates it, developer must paste it into interpreter.py. The empty dict default was the bug.- Terse interpreter is a live NCI dependency — any breaking changes to lexer, parser, interpreter, or errors must be flagged for NCI sync at
lib/terse/ - custom_blocks + block_reasons pattern — Terse rules load into SafetyProfile as keyword/reason pairs. Fast pre-check layer, not a replacement for semantic reasoning. Synonym gaps are handled by Layers 0, 4, 5 (Ollama + NCI brain)
- Stage 1 integration complete — Terse as NCI's declaration layer. Stage 2 begins after Phase 3 LLVM is complete.
Integration Architecture¶
rules/ethics_rules.trs <- written in Terse
|
terse_loader.py <- reads .trs, extracts deny rules
|
SafetyProfile.custom_blocks <- keyword list
SafetyProfile.block_reasons <- keyword -> reason string
|
EthicsEngine._check_profile() <- Layer 4, fast string match
|
Oracle response <- includes reason from .trs file
Next Session Goals¶
- Begin Phase 3 — LLVM emitter architecture planning
- Add float/numeric support — resonance scores need real floats, prerequisite for deeper NCI integration
- Future:
pyproject.tomlso NCI can import Terse as a proper package instead of file copy
Related Projects¶
| Project | Status |
|---|---|
| NCI | Session 31+ — Stage 1 Terse integration live on Oracle |
| Terse | Phase 2.5 complete — first native binary |