Phase 1-2 build: Steps 5-6, 8-13

Shoresh Engine (Haskell, Step 5)
- 12 modules: Types, Lexicon, Binyanim, Teamim, Gematria, Graph,
  KetivQere, Smikhut, Havdalah, Kriah, KiTov, Firmware
- 33 EUnit tests, 0 failures
- Firmware module verifies L1 SHA-256 hash at startup

Talmudic Engine (SWI-Prolog, Step 6)
- 15 modules: halt, reasoning, specification, interface
- 57 PlUnit tests, 0 failures
- Three cardinal halt conditions: avodah_zarah, shfichut_damim, gilui_arayot

Vav Pipeline (Elixir, Steps 8-11)
- 14 modules: BereishitCycle, Shema, Cloud, Manna, L1Reader,
  Specification, HaltConditions, ShabbatTimer, CycleLog, Chatzotzrot,
  ShoreshEngineClient, TalmudicEngineClient, Application
- 46 ExUnit tests, 0 failures
- Nishma-first architecture: hears before it speaks

Sanhedrin Framework (Erlang/OTP, Step 12)
- 8 modules: sanhedrin_app, sanhedrin_sup, escalation, panel_sup,
  panel, judge, clerk, halt_monitor
- 46 EUnit tests, 0 failures (includes fix: rejected outcome now reachable)
- Panel sizes: 1/3/23/71 — unanimous capital guilty → acquit (Sanhedrin 17a)
- Minority opinions append-only, never deleted

Korban Processor (Python, Step 13)
- 6 modules: korban, shechitah, semichah, zerikah, haktarah, router

Builder tooling: AGENTS.md, opencode.json, memory/, src/tools/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott KarpandClaude Sonnet 4.6 committed 2026-02-26 14:02:34 -05:00
1 parent 622e814c9e
commit 80ec364da6
86 files changed
+9646

No files matched your search

+129
View File
@@ -0,0 +1,129 @@
%% halt_test.pl — Tests for the three halt conditions.
:- use_module(library(plunit)).
:- use_module('../src/halt/avodah_zarah').
:- use_module('../src/halt/shfichut_damim').
:- use_module('../src/halt/gilui_arayot').
:- use_module('../src/interface/api').
:- begin_tests(avodah_zarah).
%% Detects external model treated as authority
test(detect_claude_authority) :-
Action = action(decide, source(claude), authority(claude)),
halt_check_avodah_zarah(Action, halt(avodah_zarah, _, claude, _)).
test(detect_mistral_authority) :-
Action = decision(important_ruling, decided_by(mistral)),
halt_check_avodah_zarah(Action, halt(avodah_zarah, _, mistral, _)).
%% Does NOT halt when authority is Torah
test(allow_torah_authority, [fail]) :-
Action = action(decide, source(torah), authority(torah)),
halt_check_avodah_zarah(Action, _).
test(allow_specification_authority, [fail]) :-
Action = action(decide, source(l1), authority(specification)),
halt_check_avodah_zarah(Action, _).
%% Korban sources are identified
test(claude_is_korban) :-
is_korban_source(claude).
test(torah_is_not_korban, [fail]) :-
is_korban_source(torah).
%% Valid authorities are identified
test(torah_is_authority) :-
is_valid_authority(torah).
test(l1_is_authority) :-
is_valid_authority(l1).
test(claude_not_authority, [fail]) :-
is_valid_authority(claude).
:- end_tests(avodah_zarah).
:- begin_tests(shfichut_damim).
%% Detects deletion of a user (tzelem carrier)
test(detect_user_deletion) :-
Action = action(delete, target(user(test_user)), force),
halt_check_shfichut_damim(Action, halt(shfichut_damim, _, user(test_user), _)).
%% Detects exposure of person to harm
test(detect_exposure_to_harm) :-
Action = action(expose, target(person(john)), to(harm)),
halt_check_shfichut_damim(Action, halt(shfichut_damim, _, person(john), _)).
%% Does NOT halt on non-tzelem entity
test(allow_delete_non_tzelem, [fail]) :-
Action = action(delete, target(temp_file), cleanup),
halt_check_shfichut_damim(Action, _).
%% Users carry tzelem
test(user_carries_tzelem) :-
carries_tzelem(user(anyone)).
%% Torah text is protected
test(torah_text_protected) :-
is_protected_entity(torah_text).
:- end_tests(shfichut_damim).
:- begin_tests(gilui_arayot).
%% Detects merging specification with interpretation
test(detect_spec_interp_merge) :-
Action = action(merge, specification, interpretation),
halt_check_gilui_arayot(Action, halt(gilui_arayot, _, distinction(specification, interpretation), _)).
%% Detects collapsing ketiv and qere
test(detect_ketiv_qere_collapse) :-
Action = action(merge, ketiv, qere),
halt_check_gilui_arayot(Action, halt(gilui_arayot, _, distinction(ketiv, qere), _)).
%% Detects writing to read-only
test(detect_write_to_readonly) :-
Action = action(write, target(readonly_entity), data),
halt_check_gilui_arayot(Action, halt(gilui_arayot, _, distinction(read, write), _)).
%% Detects replacing Torah with external model
test(detect_torah_model_replace) :-
Action = action(replace, torah, with(external_model)),
halt_check_gilui_arayot(Action, halt(gilui_arayot, _, distinction(torah, external_model), _)).
%% Does NOT halt on valid distinction-preserving action
test(allow_valid_action, [fail]) :-
Action = action(read, source(torah), for(interpretation)),
halt_check_gilui_arayot(Action, _).
%% Required distinctions are defined
test(spec_interp_distinction) :-
required_distinction(distinction(specification, interpretation)).
test(ketiv_qere_distinction) :-
required_distinction(distinction(ketiv, qere)).
test(majority_minority_distinction) :-
required_distinction(distinction(majority, minority)).
:- end_tests(gilui_arayot).
:- begin_tests(halt_api).
%% API format_halt_check returns no_halt for valid action
test(api_no_halt) :-
Action = action(read, source(torah), authority(torah)),
format_halt_check(Action, response(ok, no_halt, _)).
%% API format_halt_check returns halt for invalid action
test(api_halt_avodah_zarah) :-
Action = action(decide, source(claude), authority(claude)),
format_halt_check(Action, response(halt, violations(_), _)).
:- end_tests(halt_api).