Files
bikoret/sanhedrin/include/sanhedrin.hrl
T
Scott KarpandClaude Sonnet 4.6 80ec364da6 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>
2026-02-26 14:02:34 -05:00

102 lines
3.4 KiB
Erlang

%%% sanhedrin.hrl — Record definitions for the Sanhedrin deliberation engine
%%%
%%% Architecture §3.2: Concurrent deliberation engine.
%%% Spawns panels of independent deliberators, collects votes,
%%% enforces mandatory dissent on capital decisions,
%%% stores minority opinions.
%% --- Case complexity levels ---
%% simple -> 1 judge
%% monetary -> 3 judges (dinei mamonot)
%% capital -> 23 judges (dinei nefashot)
%% novel -> 71 judges (Sanhedrin Gedolah)
-type complexity() :: simple | monetary | capital | novel.
%% --- Case outcome ---
-type outcome() :: accepted | rejected | teiku.
%% --- Unanimous check result ---
-type unanimous_check() :: passed | {failed, suspicion_of_consensus}.
%% --- Torah reference ---
-record(torah_ref, {
book :: atom(), %% bereishit | shemot | vayikra | bamidbar | devarim
chapter :: pos_integer(),
verse :: pos_integer()
}).
%% --- A root with domain ---
-record(root_info, {
shoresh :: list(atom()), %% e.g. [bet, resh, aleph]
domain :: atom() %% e.g. creation, justice, holiness
}).
%% --- Case submission (Pipeline → Sanhedrin) ---
%% Construction spec §3.2
-record(sanhedrin_case, {
case_ref :: binary(), %% UUID
complexity :: complexity(),
question :: binary(),
context :: map(), %% #{roots, torah_refs, prior_interpretations, shema_context}
requested_by :: binary(),
submitted_at :: integer() %% erlang:system_time(millisecond)
}).
%% --- Individual judge vote ---
-record(vote, {
judge_id :: reference(),
position :: binary(), %% The interpretation
reasoning :: binary(), %% Why this position
torah_refs :: [#torah_ref{}], %% Grounding references
verdict :: accept | reject | abstain,
cast_at :: integer()
}).
%% --- Panel record ---
-record(panel, {
panel_id :: binary(),
case_ref :: binary(),
size :: pos_integer(), %% 1, 3, 23, or 71
judges :: [pid()],
votes :: [#vote{}],
status :: convened | deliberating | decided | dissolved,
convened_at :: integer(),
decided_at :: integer() | undefined
}).
%% --- Deliberation decision ---
%% Construction spec §3.2 — output format
-record(decision, {
case_ref :: binary(),
outcome :: outcome(),
majority :: map(), %% #{position, reasoning, torah_refs, vote_count}
minority :: map(), %% #{position, reasoning, torah_refs, vote_count}
panel_size :: pos_integer(),
deliberation_time_ms :: non_neg_integer(),
unanimous_check :: unanimous_check()
}).
%% --- Opinion record (stored by clerk, never deleted) ---
-record(opinion, {
case_ref :: binary(),
judge_id :: reference(),
position :: binary(),
reasoning :: binary(),
torah_refs :: [#torah_ref{}],
verdict :: accept | reject | abstain,
is_majority :: boolean(),
stored_at :: integer()
}).
%% --- Panel size constants ---
-define(PANEL_SIMPLE, 1).
-define(PANEL_MONETARY, 3).
-define(PANEL_CAPITAL, 23).
-define(PANEL_NOVEL, 71).
%% --- Deliberation timeouts (Construction spec §2.2) ---
-define(TIMEOUT_SIMPLE, 15000). %% 15 seconds
-define(TIMEOUT_MONETARY, 15000). %% 15 seconds
-define(TIMEOUT_CAPITAL, 120000). %% 120 seconds
-define(TIMEOUT_NOVEL, 600000). %% 600 seconds