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

+114
View File
@@ -0,0 +1,114 @@
%% interpret.pl — Interpretation generation.
%%
%% Architecture §3.4:
%% interpret(Case, Interpretation) :-
%% find_relevant_mitzvot(Case, Mitzvot),
%% find_relevant_verses(Case, Verses),
%% construct_interpretation(Mitzvot, Verses, Interpretation).
%%
%% An interpretation is grounded in Torah — it consists of:
%% 1. Relevant mitzvot that apply to the case
%% 2. Relevant verses that inform the case
%% 3. A constructed reading that connects them
:- module(interpret, [
interpret/2,
find_relevant_mitzvot/2,
find_relevant_verses/2,
construct_interpretation/4
]).
:- use_module('../specification/mitzvot').
:- use_module('../specification/torah_text').
:- use_module('../specification/root_meanings').
:- use_module('../specification/relationships').
%% A case is represented as:
%% case(Ref, Domain, Roots, Question)
%% - Ref: a unique identifier
%% - Domain: the semantic domain of the question
%% - Roots: list of Hebrew roots involved
%% - Question: the question being asked
%% ============================================================
%% INTERPRETATION
%% ============================================================
%% Propose an interpretation of a case.
%% An interpretation is:
%% interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence)
interpret(Case, Interpretation) :-
Case = case(Ref, _Domain, _Roots, _Question),
find_relevant_mitzvot(Case, Mitzvot),
find_relevant_verses(Case, Verses),
construct_interpretation(Ref, Mitzvot, Verses, Interpretation).
%% ============================================================
%% FIND RELEVANT MITZVOT
%% ============================================================
%% Strategy: find mitzvot in the same domain as the case,
%% plus mitzvot whose source verses share roots with the case.
find_relevant_mitzvot(case(_Ref, Domain, Roots, _Question), Mitzvot) :-
%% Mitzvot in the same domain
findall(mitzvah(ID, Cat, Action, Cond),
( mitzvah_domain(ID, Domain),
mitzvah(ID, Cat, Action, Cond)
),
DomainMitzvot),
%% Mitzvot whose source verses share roots with the case
findall(mitzvah(ID, Cat, Action, Cond),
( mitzvah_source(ID, ref(Book, Ch, Vs)),
verse(Book, Ch, Vs, VerseRoots, _),
member(Root, Roots),
member(Root, VerseRoots),
mitzvah(ID, Cat, Action, Cond)
),
RootMitzvot),
append(DomainMitzvot, RootMitzvot, AllMitzvot),
sort(AllMitzvot, Mitzvot). % remove duplicates
%% ============================================================
%% FIND RELEVANT VERSES
%% ============================================================
%% Strategy: find verses that mention any of the case's roots.
find_relevant_verses(case(_Ref, _Domain, Roots, _Question), Verses) :-
findall(verse_ref(Book, Ch, Vs, Gloss),
( member(Root, Roots),
verse(Book, Ch, Vs, VerseRoots, Gloss),
member(Root, VerseRoots)
),
AllVerses),
sort(AllVerses, Verses). % remove duplicates
%% ============================================================
%% CONSTRUCT INTERPRETATION
%% ============================================================
%% Build an interpretation from the collected mitzvot and verses.
%% Confidence is based on the strength of grounding:
%% - high: both mitzvot and verses found
%% - medium: only mitzvot or only verses
%% - low: neither (but still generates a minimal reading)
construct_interpretation(CaseRef, Mitzvot, Verses, Interpretation) :-
assess_confidence(Mitzvot, Verses, Confidence),
build_reading(Mitzvot, Verses, Reading),
Interpretation = interpretation(CaseRef, Mitzvot, Verses, Reading, Confidence).
%% Assess confidence based on grounding
assess_confidence(Mitzvot, Verses, high) :-
Mitzvot \= [],
Verses \= [], !.
assess_confidence(Mitzvot, _, medium) :-
Mitzvot \= [], !.
assess_confidence(_, Verses, medium) :-
Verses \= [], !.
assess_confidence(_, _, low).
%% Build a reading — the interpretive connection between sources
build_reading(Mitzvot, Verses, Reading) :-
length(Mitzvot, MCount),
length(Verses, VCount),
Reading = reading(mitzvot_count(MCount), verse_count(VCount),
grounded_in(Mitzvot, Verses)).