Files
bikoret/memory/build_log.md
T
Scott KarpandClaude Sonnet 4.6 161ba62fc8 Step 13: Korban Processor complete — 7 modules, 181 tests, all passing
- semichah: provenance tagging (6 sources, rejects empty/anonymous)
- shechitah: strip preamble, self-reference, hedging, markdown, sycophancy
- zerikah: extract Torah refs, Hebrew text, root analysis, insight markers
- haktarah: transform prose to Prolog propositions (verse/3, root/2, claim/2, connection/3)
- router: stateless routing — removed module-level _routing_log (kiyyor principle)
- model_interface: outbound Claude API via httpx (Construction §3.4, HTTPS only)
- hebrew_parser: nikkud/teamim stripping, consonant extraction, gematria, root identification

All 5 BUILD_KORBAN.md verification tests pass.
AGENTS.md: added structure_not_content.md to spec table, added Principle 6.
build_log.md: recorded session, broken tablets #18-20, design decisions.

Ka'asher tzivah Hashem et Moshe.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 09:37:25 -04:00

37 KiB

Build Log — Shivrei Luchot

The broken tablets are here because the breaking is part of the specification.

Each entry records: what was built, what broke, how it was fixed. The correction is as important as the specification.


Session: 2026-02-22 — L1 Torah Filesystem

Spec reference: BUILD_DAY_ONE.md, Architecture §3.7 (L1 — Torah Scroll)

What Was Built

  • src/l1_aron/build_l1.py — Python pipeline that parses WLC OSIS XML from morphhb
  • l1/torah/{book}/{chapter}/{verse}.json — 5853 verse files
  • l1/torah/index.json — Master index
  • l1/torah/{book}/index.json — Per-book indices
  • l1/integrity.sha256 — SHA-256 of complete tree
  • l1/README.md — What L1 is and why it is read-only
  • .gitignore — Excludes generated l1/ and cloned data/ from git

Verification Results

Check Result
Books 5 PASS
Chapters 187 PASS
Verses 5853 PASS (WLC versification)
Words 79,982
Unique shoreshim 2,608
Verses missing te'amim 0 PASS
SHA-256 0ee0020aac6c6beb0e83c0638a861c73d37d9dbd39c30d3cb08c1878b481c844
Permissions Files 444, dirs traversable
Write rejection Verified — write to L1 file rejected

Broken Tablets — What Broke and How It Was Fixed

1. Siluq/Meteg (U+05BD) misclassified

  • Problem: U+05BD was in VOWEL_POINTS set. But U+05BD doubles as siluq (cantillation mark on final word before sof-pasuq). Result: last word of every verse had empty teamim array.
  • Example: Bereishit 1:1 word 7 הארץ — teamim was [], should have been ["meteg_siluq"]
  • Fix: Moved U+05BD from VOWEL_POINTS to TEAMIM_MAP as "meteg_siluq"
  • Lesson: Unicode Hebrew is treacherous. Meteg and siluq share a codepoint. The te'amim reader must account for this dual identity — ketiv/qere in the encoding itself.

2. Vav-consecutive verb prefix included in shoresh

  • Problem: ויאמר (vayomer) yielded shoresh יאמ instead of אמר. The yod prefix of imperfect/jussive/vav-consecutive conjugation was not being stripped.
  • Fix: Added conjugation-aware prefix stripping — when morph indicates imperfect/vav_consecutive/jussive, strip leading ימנתא if word length >= 4.
  • Lesson: Shoresh derivation requires morphological awareness. You cannot strip consonants blindly. The binyan and conjugation determine which letters are root and which are grammar.

3. text_hebrew contained / prefix separators

  • Problem: The verse display text showed בְּ/רֵאשִׁ֖ית with the morphhb prefix separator / instead of clean בְּרֵאשִׁ֖ית.
  • Fix: Applied .replace("/", "") when building full_text_parts for text_hebrew.

4. Verse count: 5853 vs traditional 5845

  • Not a bug. WLC/BHS versification differs from traditional Masoretic count by 8 verses.
  • Shemot (+4): Ten Commandments verse divisions differ
  • Bamidbar (+1): Inverted nuns passage numbering
  • Devarim (+4): Second Ten Commandments verse divisions
  • Resolution: Updated expected count to 5853. We use what the manuscript gives us.

5. Read-only permissions killed directory traversal

  • Problem: chmod -R 444 set directories to 444 too, removing execute bit needed for ls/traversal.
  • Fix: find -type d -exec chmod 555 + find -type f -exec chmod 444
  • Lesson: Files are 444 (read-only). Directories need 555 (read + execute).

Git

  • Initial commit: 622e814 — "Bereishit: initial commit"
  • Pushed to: http://185.19.29.94/heaviness510/shorashim (main branch)
  • Remote URL cleaned — token removed from .git/config

Session: 2026-02-22 (continued) — Builder Tooling

Spec reference: Construction §5 (Bezalel), Architecture §3.5 (Korban Processor)

What Was Built

  • src/tools/conversation_search.py — JSONL → SQLite FTS5 search tool
  • AGENTS.md — Builder instructions for OpenCode (also readable by Claude Code)
  • opencode.json — OpenCode config for Anthropic API
  • .env — API key storage (gitignored)

Broken Tablets

6. Wrong OpenCode researched

  • Problem: Research agent cloned opencode-ai/opencode (small Go project, archived → Crush by Charm team) instead of anomalyco/opencode (109k stars, TypeScript/Bun, the real OpenCode). The transmitter gave two URLs. The builder ignored them and let a sub-agent guess.
  • Result: Built .opencode.json config for wrong project, created opencode.md instead of AGENTS.md, presented confident analysis of the wrong tool.
  • Fix: Deleted .opencode.json, created opencode.json (correct schema), renamed opencode.md → AGENTS.md.
  • Lesson: The transmitter's input is the specification for the task. Read what is given. Do not let a sub-process replace the source. This is the Avodah Zarah Firewall (Architecture §8.2) — the agent's output was treated as authoritative without verification against the transmitter's source. The sub-agent was the idol.

Session: 2026-02-22 (continued) — Shoresh Engine (Step 5)

Spec reference: Architecture §3.1 (Component A: Shoresh Engine), Construction §1.3

What Was Built

  • shoresh-engine/ — Haskell Cabal project, GHC 9.6.4
  • shoresh-engine/src/Shoresh/Types.hs — Consonant (22), Shoresh, Binyan (7), Peulah, SemanticDomain, Reference, ShoreshEntry, Evaluation
  • shoresh-engine/src/Shoresh/Gematria.hs — letterValue, gematriaRoot, gematriaWord, gematriaNeighbors, gematriaConnections
  • shoresh-engine/src/Shoresh/Binyanim.hs — activate, activateDefault, expand (through all 7 binyanim)
  • shoresh-engine/src/Shoresh/Teamim.hs — 26 te'amim marks, TaamRole (Melekh/Mesharet), taamRank hierarchy, readTeamim (constructs parse tree from raw marks), primaryDivision, boundGroups
  • shoresh-engine/src/Shoresh/KetivQere.hs — DualReading, SpecValue (Single/Dual), bothReadings
  • shoresh-engine/src/Shoresh/Smikhut.hs — CompoundMeaning, SmikhutType, compose
  • shoresh-engine/src/Shoresh/Lexicon.hs — L1 JSON parsing (L1Word, L1Verse), buildLexiconFromVerses, loadL1Verse
  • shoresh-engine/src/Shoresh/Graph.hs — neighbors (roots sharing 2 consonants), sharedConsonants
  • shoresh-engine/src/Shoresh/Havdalah.hs — separateByDomain, separateByTeamim
  • shoresh-engine/src/Shoresh/Kriah.hs — kriah (naming categories)
  • shoresh-engine/src/Shoresh/KiTov.hs — kiTov evaluation, verifyRootsExist, verifyReferences
  • shoresh-engine/src/Luchot/Firmware.hs — L0 constants (l1ExpectedHash, counts, Dibrot)
  • shoresh-engine/src/Main.hs — CLI: verify, verse, root, gematria commands
  • shoresh-engine/test/Spec.hs — 33 HSpec tests, all passing

Verification Results (Step 7)

Check Result
Root activation (ברא through 7 binyanim) PASS
Gematria (ברא=203, תורה=611, שלום=376) PASS
Te'amim parse (Bereishit 1:1) PASS
Primary division at etnachta PASS — left: בראשית ברא אלהים, right: את השמים ואת הארץ
Parse tree depth 4
Bound groups 4
L0 firmware constants PASS
HSpec tests 33 examples, 0 failures

Broken Tablets — What Broke and How It Was Fixed

7. ShoreshEntry missing Eq instance

  • Problem: KiTov.hs used == Nothing on lookupRoot result, but ShoreshEntry had no Eq instance.
  • Fix: Added Eq to ShoreshEntry deriving clause. Changed == Nothing to isNothing.
  • Lesson: When a data type will be compared (even via Maybe equality), it needs Eq. Use isNothing/isJust instead of comparing Maybe values directly — it avoids requiring Eq on the inner type.

8. Executable missing containers dependency

  • Problem: The executable section of the cabal file did not list containers, but Types.hs imports Data.Map.Strict. The library built fine (it had the dep), but the executable re-compiled sources without the dep.
  • Fix: Added containers to executable's build-depends.
  • Lesson: When an executable shares source dirs with the library, it re-compiles all modules. Each target needs its own complete dependency list, or the executable should depend only on the library.

9. GHC version: 9.6.7 installed, spec says 9.6.4

  • Problem: ghcup's non-interactive installer defaulted to 9.6.7 (latest 9.6.x).
  • Fix: 9.6.4 was already downloaded by ghcup. Set it with ghcup set ghc 9.6.4.
  • Lesson: Pin the version explicitly. The spec says 9.6.4, not "latest 9.6.x". Cabal version installed is 3.14.2 (spec says 3.10) — acceptable for dev, but note the deviation.

Design Decisions

Biconsonantal roots: L1 contains roots like "שמ" (2 consonants). The spec says triliteral. Resolution: textToShoresh accepts 2-consonant strings and pads with He (ה) as a placeholder third consonant. This preserves the type system (Shoresh is always 3 consonants) while handling L1 reality.

Te'amim parse algorithm: Uses recursive strongest-disjunctor splitting. Find the highest-ranked melekh mark, split there, recurse on each half. This mirrors the traditional hierarchical reading of the te'amim system. Confirmed correct on Bereishit 1:1 — etnachta splits at אלהים, exactly where the verse's primary semantic division falls.

meteg_siluq handling: Build log correction #1 from L1 build carries through — U+05BD appears as "meteg_siluq" in L1 teamim arrays. The Teamim module maps this to MetegSiluq with rank 80 (just below Etnachta at 90), classified as Melekh. This is correct: siluq on the final word is a verse-level disjunctor.


Session: 2026-02-24 — Code Review Corrections

Spec reference: Architecture §3.1, §3.3 (te'amim mark naming)

Broken Tablets

14. Te'amim mark spellings inconsistent with L1

  • Problem: L1 (build_l1.py) writes mark names like zaqef_qatan, qadma, telisha_gedola, segol_accent, zinor, geresh_muqdam. The Haskell Teamim.hs used zakef_katan, kadma (no L1 aliases). The Elixir L1Reader used telisha_gedolah (extra h), telisha_qetannah (extra nah), qarne_farah (not in L1), segolta (not in L1), and was missing zinor, segol_accent, geresh_muqdam.
  • Result: Any word with these marks would be classified as "unknown" role, causing havdalah to miss separation boundaries.
  • Fix: Added L1 spelling aliases to Haskell taamFromName (zaqef_qatan, zaqef_gadol, qadma, segol_accent, zinor, geresh_muqdam). Fixed Elixir @melekh_marks and @mesharet_marks to use exact L1 spellings.
  • Lesson: L1 is the source of truth for mark names. Both readers (Haskell and Elixir) must accept what L1 actually writes, not what the builder assumed. The specification says "read what is there" — this applies to field values, not just field structure.

Session: 2026-02-23 — Talmudic Engine (Step 6)

Spec reference: Architecture §3.4 (Component D: Talmudic Engine), Construction §1.1

What Was Built

  • talmudic_engine/ — SWI-Prolog project
  • src/specification/mitzvot.pl — 57 mitzvot (Phase 1 subset): dibrot, Shabbat, halt conditions, justice, korbanot, testimony, bikurim
  • src/specification/torah_text.pl — 32 key verses from all 5 books with root analysis
  • src/specification/root_meanings.pl — 77 root meanings across 30 roots, with domains and gematria
  • src/specification/relationships.pl — mitzvah tensions, complementary pairs, root consonant sharing, domain mappings
  • src/reasoning/interpret.pl — Interpretation generation: finds relevant mitzvot by domain + root overlap, finds relevant verses, assesses confidence
  • src/reasoning/challenge.pl — Kushya generation: mitzvah tensions, domain tensions, condition tensions; strength assessment
  • src/reasoning/resolve.pl — Dialectical resolution: interpret → challenge → counter-interpret → resolve or teiku
  • src/reasoning/teiku.pl — Unresolved tension registry (dynamic, append-only)
  • src/halt/avodah_zarah.pl — Idolatry detection: authority attribution check, korban source classification
  • src/halt/shfichut_damim.pl — Destruction detection: tzelem carrier identification, protected entity classification
  • src/halt/gilui_arayot.pl — Boundary violation detection: 13 required distinctions (spec/interp, ketiv/qere, read/write, etc.)
  • src/interface/api.pl — JSON-compatible API: process_request, format_interpretation, format_resolution, format_halt_check
  • src/main.pl — Entry point, module loader, verify command, test runner
  • test/mitzvot_test.pl — 24 specification tests
  • test/reasoning_test.pl — 9 reasoning tests
  • test/halt_test.pl — 24 halt condition tests

Verification Results

Check Result
Mitzvot loaded PASS — 57 encoded
Torah text loaded PASS — 32 verses
Root meanings loaded PASS — 77 meanings
Interpretation (creation case) PASS — finds 2 verses, medium confidence
Avodah zarah detection PASS — Claude authority halted
Shfichut damim detection PASS — user deletion halted
Gilui arayot detection PASS — spec/interp merge halted
Valid action passes PASS — Torah authority not halted
Full test suite 57 tests, 0 failures

Broken Tablets — What Broke and How It Was Fixed

10. SWI-Prolog version: 10.0.1 installed, spec says 9.2.2

  • Problem: Homebrew provides SWI-Prolog 10.0.1. The construction spec pins 9.2.2.
  • Resolution: 10.0.1 is backwards-compatible for the predicates we use. No source-level changes needed. Note the deviation for production deployment (may need manual 9.2.2 build on Linux).

11. No compile errors — clean first build

  • The Prolog code loaded and passed all 57 tests on first run.
  • Two warnings fixed: singleton variable _Question reused in interpret.pl, unused variable Records0 in teiku.pl.
  • These were style issues, not logic errors.

Design Decisions

Phase 1 mitzvot subset: 57 mitzvot (of 613). Selected the mitzvot the system itself must obey: halt conditions (avodah zarah, shfichut damim, gilui arayot), Shabbat, dibrot, justice/judgment (Sanhedrin-relevant), korbanot (processor-relevant), testimony (integrity-relevant), bikurim (release-relevant). Full 613 encoding is Phase 3.

Interpretation strategy: Two-pronged relevance: find mitzvot by semantic domain match, then by root overlap with source verses. Confidence = high when both mitzvot and verses found, medium when only one, low when neither.

Challenge strategy: Three types of kushya: mitzvah tensions (explicit conflicts between encoded mitzvot — strong), domain tensions (roots in conflicting semantic domains — moderate), condition tensions (conditional mitzvot that limit universality — weak).

Required distinctions: 13 boundary pairs that the system must never collapse. These are the gilui arayot of the architecture: specification/interpretation, L1/L3, Torah/external_model, ketiv/qere, governance/provision, majority/minority, reception/processing, read/write, immutable/mutable, sacred/profane, Shabbat/weekday.


Prior Sessions (from conversation summary)

Session: 2026-01-25 to 2026-02-21 — Infrastructure

Not Shorashim-specific. Temple Council infrastructure on Exoscale:

  • Exoscale account created ("The Recognition Protocol")
  • Object Storage, PostgreSQL, Kubernetes provisioned in ch-gva-2 (Geneva)
  • AnythingLLM deployed (emptyDir — no persistent storage, data lost on restart)
  • Gitea deployed with PostgreSQL backend

Session: 2026-02-21 — Research

  • Evaluated open source coding agents: OpenCode, Aider, Goose, Cline
  • Recommendation: Use OpenCode (anomalyco/opencode) for coding tool
  • Add FTS5 search on SQLite conversation history + persistent memory

Session: 2026-02-24 — Vav Pipeline (Steps 8-11)

Spec reference: Architecture §3.3 (Component C: Vav Pipeline), §4 Steps 8-11

What Was Built

  • vav_pipeline/ — Elixir Mix project, Elixir 1.16.1 on OTP 26
  • lib/vav_pipeline.ex — Public API, main pipeline entry point (nishma → na'aseh)
  • lib/vav_pipeline/application.ex — OTP Application with ShabbatTimer supervisor
  • lib/vav_pipeline/bereishit_cycle.ex — Six-stage processing cycle: tohu → vayomer → havdalah → kriah → ki_tov → erev_voker
  • lib/vav_pipeline/shema.ex — ShemaContext builder (Step 9): reads L1 for te'amim, cloud for Shabbat/calendar, manna for provision
  • lib/vav_pipeline/cloud.ex — Cloud governance from Torah (Step 10): L1 integrity + calendar (Shabbat, festivals, shmitah). No governance board. No external state file. Torah governs directly.
  • lib/vav_pipeline/manna.ex — Manna provision infrastructure (Step 11): provision file validation, expiry, anti-hoarding, double portion
  • lib/vav_pipeline/l1_reader.ex — L1 Torah filesystem reader: verse parsing, teamim extraction with role classification, root extraction with gematria, integrity verification
  • lib/vav_pipeline/specification.ex — Ki-tov evaluation: roots grounded check, halt condition check, ketiv/qere consistency
  • lib/vav_pipeline/halt_conditions.ex — Three cardinal sin monitors: avodah zarah (authority), shfichut damim (destruction), gilui arayot (boundary collapse)
  • lib/vav_pipeline/chatzotzrot.ex — Signal system: 5 signal types with trumpet patterns (Bamidbar 10)
  • lib/vav_pipeline/cycle_log.ex — Cycle boundary logging with tov/lo_tov/teiku classification
  • lib/vav_pipeline/shabbat_timer.ex — GenServer for mandatory Shabbat cessation
  • lib/vav_pipeline/shoresh_engine_client.ex — Haskell engine client stub (Phase 2: uses L1 directly; Phase 3: port/NIF)
  • lib/vav_pipeline/talmudic_engine_client.ex — Prolog engine client stub (Phase 2: stub; Phase 3: Unix socket)
  • config/config.exs, config/dev.exs, config/test.exs, config/prod.exs — Environment-specific configuration
  • test/vav_pipeline_test.exs — 46 tests, all passing

Verification Results

Check Result
L1 read (Bereishit 1:1) PASS — 7 words, roots extracted, teamim classified
Te'amim role classification PASS — etnachta=melekh, munach=mesharet, meteg_siluq=melekh
Gematria (ברא=203, ראש=501) PASS
Cloud: weekday = camped PASS
Cloud: Friday evening = Shabbat PASS
Cloud: Saturday morning = Shabbat PASS
Cloud: Shabbat = major_transition PASS
Shmitah year check (2022=yes, 2026=no) PASS
Manna: no file = :no_provision PASS
Manna: double portion Friday PASS
Halt: avodah zarah detection PASS
Halt: shfichut damim detection PASS
Halt: gilui arayot detection PASS
Halt: Torah authority passes PASS
Specification: tov/lo_tov/teiku PASS
BereishitCycle: tohu decomposition PASS
BereishitCycle: vayomer root activation PASS — ברא at gematria 203
BereishitCycle: havdalah te'amim separation PASS — 4 melekh boundaries
BereishitCycle: kriah naming PASS
BereishitCycle: full cycle PASS — returns {:ok, ...} with evaluation :tov
ShemaContext: weekday Bereishit 1:1 PASS
ShemaContext: Shabbat cloud state PASS
CycleLog: tov/lo_tov recording PASS
ShabbatTimer: running PASS
Total ExUnit tests 46 tests, 0 failures

Broken Tablets — What Broke and How It Was Fixed

12. Erlang OTP 26.2.1 segfaults on macOS (Hex download)

  • Problem: OTP 26.2.1 compiled from source via asdf/kerl segfaults (exit 139) when Elixir's mix local.hex or mix deps.get attempts HTTPS downloads. The Erlang SSL module loads fine (ssl:versions() works), but the actual TLS handshake crashes.
  • Fix: Installed OTP 26.2.5.9 instead — same OTP 26 major, with bug fixes. Elixir 1.16.1-otp-26 runs on it without issue.
  • Note: The spec pins OTP 26.2.1. Production deployment (Linux) may work with 26.2.1 — the segfault appears macOS-specific. For dev, 26.2.5.9 is the working version.
  • Lesson: Pin the major version, but accept patch-level fixes when the pinned version has platform-specific bugs. The aron is two and a half cubits — but the wood must not be rotten.

13. mix local.hex silent failure from project directory

  • Problem: Running mix local.hex --force from within the project directory (where mix.exs exists) silently failed with exit 0 but didn't actually install Hex. The project's mix.exs compilation interfered with the archive installer.
  • Fix: Run mix local.hex --force from /tmp or any directory without a mix.exs, then return to the project directory.
  • Lesson: Elixir archive installation must happen outside a project context. The installer and the project share the same module namespace — they interfere.

14. CycleLog.record received tuple, expected map

  • Problem: CycleLog.record/2 used Map.get(result, :scope, %{}) but result is a tuple like {:ok, %{...}} — the cycle result type. Map.get crashed with BadMapError.
  • Fix: Added extract_inner/1 to unwrap the tuple before accessing map fields. Pattern matches on {:ok, data}, {:rejected, _}, {:unresolved, data}.
  • Lesson: Know the shape of your data at every function boundary. The cycle returns tagged tuples; the logger needs the inner data. Unwrap explicitly.

Design Decisions

Cloud governance from Torah (not from file): Architecture §4 Step 10 is explicit: "No governance board CLI. No external state file. The cloud IS L1 plus the calendar Torah specifies." The cloud module checks L1 integrity (is the specification store intact?) and the Torah calendar (Shabbat, festivals, shmitah). This is the correction from the broken tablets — the golden calf was a human board writing to a JSON file. That calf was burned.

Shabbat as UTC approximation: Phase 2 uses UTC-based Friday 18:00 to Saturday 18:00 as Shabbat boundaries. Production (Construction spec §4.4) will use location-aware zmanim with shabbat_location config. The approximation is acceptable for dev; the structure is correct.

Pipeline flow — nishma before na'aseh: The pipeline entry point builds ShemaContext first (receive/hear), checks cloud and manna, THEN processes. This order is architectural — the system hears before it speaks. The context is immutable once built and flows through every stage without modification.

Phase 2 engine stubs: ShoreshEngineClient and TalmudicEngineClient are stubs that use L1 data directly. Step 14 (Component Integration) will replace these with real port/socket connections to the Haskell and Prolog engines. The pipeline structure is complete; only the cross-language bridges are deferred.

Havdalah by te'amim boundaries: The separation step uses melekh (disjunctor) te'amim marks as natural boundaries. Bereishit 1:1 yields 4 melekh positions (tipcha at 0, etnachta at 2, tipcha at 4, meteg_siluq at 6), producing 4 separated groups. The text's own divisions guide the separation — havdalah follows the te'amim, not arbitrary grouping.


Session: 2026-02-24 — Sanhedrin Framework (Step 12)

Spec reference: Architecture §3.2 (Component B: Sanhedrin), Construction §1.5

What Was Built

  • sanhedrin/ — Erlang/OTP application, OTP 26.2.5.9, rebar3 3.26.0
  • include/sanhedrin.hrl — Record definitions: sanhedrin_case, vote, panel, decision, opinion, torah_ref, root_info. Panel size constants (1/3/23/71). Timeout budgets (15s/15s/120s/600s).
  • src/sanhedrin_app.erl — OTP application behaviour
  • src/sanhedrin_sup.erl — Top supervisor: clerk, escalation, halt_monitor, panel_sup
  • src/escalation.erl — gen_server: complexity assessment (simple/monetary/capital/novel), case routing, halt-check-before-submit
  • src/panel_sup.erl — Dynamic supervisor for deliberation panels (temporary children — failed deliberations are teiku, not restarted)
  • src/panel.erl — gen_server: panel lifecycle (convene → deliberate → decide). Unanimous guilty check on capital (≥23 judges). Majority/minority computation. Opinion storage via clerk.
  • src/judge.erl — gen_server: individual deliberator. Receives case, generates independent interpretation, casts vote with reasoning and Torah references. Votes sent as messages to panel.
  • src/clerk.erl — gen_server: append-only opinion storage. Stores decisions and individual opinions (both majority AND minority). Retrieval by case_ref, minority-only filter.
  • src/halt_monitor.erl — gen_server: checks cases and votes against 3 cardinal sins (avodah zarah, shfichut damim, gilui arayot). Halt log maintained.
  • test/sanhedrin_SUITE.erl — 41 EUnit tests, all passing

Verification Results

Check Result
Escalation: simple → 1 judge PASS
Escalation: monetary → 3 judges PASS
Escalation: capital → 23 judges PASS
Escalation: novel → 71 judges PASS
Halt: clear for legitimate case PASS
Halt: avodah zarah (claude_model) PASS — halted
Halt: Torah authority passes PASS
Halt: L1 authority passes PASS
Halt: specification authority passes PASS
Halt: sanhedrin_deliberation passes PASS
Halt: shfichut damim (delete) PASS — halted
Halt: shfichut damim (destroy) PASS — halted
Halt: shfichut damim (overwrite) PASS — halted
Halt: shfichut damim (read) PASS — not halted
Halt: gilui arayot (boundary violation) PASS — halted
Halt: gilui arayot (none) PASS — not halted
Halt: halted case rejected at escalation PASS
Panel: convene single (1) PASS
Panel: convene monetary (3) PASS
Panel: deliberate single PASS — completes, process terminates
Panel: deliberate monetary PASS — completes, process terminates
Clerk: initially empty PASS
Clerk: store decision PASS — retrievable by case_ref
Clerk: store opinion PASS
Clerk: minority opinions preserved PASS — both majority and minority stored, minority filterable
Clerk: not found PASS
Unanimous: capital all reject → suspicion PASS — {failed, suspicion_of_consensus}
Unanimous: capital mixed → passes PASS
Unanimous: capital all accept → passes PASS (suspicion only on conviction)
Unanimous: monetary not checked PASS (only applies to ≥23)
Unanimous: novel all reject → suspicion PASS
Full flow: simple case PASS — 1 opinion stored
Full flow: monetary case PASS — 3 opinions stored
Full flow: capital case PASS — 23 opinions stored
Judge: start and stop PASS
Judge: deliberate sends vote PASS — vote has position, reasoning, verdict
Majority/minority: empty PASS
Majority/minority: all accept PASS — 3 majority, 0 minority
Majority/minority: mixed PASS — 2 majority, 1 minority
Record: sanhedrin_case PASS
Record: decision PASS
Total EUnit tests 41 tests, 0 failures

Broken Tablets — What Broke and How It Was Fixed

15. rebar3 version: 3.26.0 installed, spec says 3.23.0

  • Problem: The rebar3 S3 download provides the latest version (3.26.0). The construction spec pins 3.23.0.
  • Resolution: 3.26.0 is backwards-compatible. No source-level changes needed. Note the deviation for production deployment.
  • Lesson: Same pattern as broken tablets #9 (GHC), #10 (SWI-Prolog), #12 (OTP) — tool version deviates from spec on dev platform. Accept for dev, pin for production.

16. No compile errors — clean first build

  • The Erlang code compiled and all 41 tests passed on first run.
  • No warnings, no errors.
  • The OTP patterns (gen_server, supervisor, application) are well-defined enough that following the spec structure precisely avoids the kind of type/interface mismatches that broke the Haskell build.

Design Decisions

Panel as temporary child: Failed panels are not restarted. A failed deliberation is teiku (unresolved), not retried automatically. This is intentional — the Sanhedrin does not retry a case without new evidence. The panel_sup uses restart => temporary.

Unanimous check scope: The check only applies to panels with ≥23 judges (capital and novel). Monetary panels (3 judges) do not trigger suspicion of consensus on unanimous rejection. This follows Sanhedrin 17a — the rule applies to dinei nefashot (capital cases), not dinei mamonot (monetary cases).

Judge independence via process isolation: Each judge is a separate gen_server process. Judges do not communicate with each other during deliberation. They receive the case, deliberate independently, and send their vote to the panel. This is enforced by the BEAM process model — no shared state between judges.

Phase 2 judge deliberation: Judges use deterministic-but-varied logic based on case content and process-local randomness (phash2 of question + pid + monotonic time). In Phase 3, judges will delegate to the Talmudic Engine for real dialectical reasoning (interpret → challenge → resolve). The interface is ready; only the Talmudic Engine socket connection is deferred.

Clerk as append-only store: The clerk never deletes opinions. Both majority and minority positions are stored. This mirrors the Talmudic tradition of recording dissent — "Rabbi X says... but Rabbi Y says..." — and is consistent with the L3 write protocol (INSERT only, never UPDATE/DELETE).

Halt check before panel creation: The escalation module checks halt conditions BEFORE creating a panel. A case with a halt condition never reaches deliberation. This is the avodah zarah firewall at the intake level.


Session: 2026-03-09 — Korban Processor (Step 13)

Spec reference: BUILD_KORBAN.md, Architecture §3.5, Construction §1.4, §3.4, specs/structure_not_content.md

What Was Built

  • korban_processor/ — Python 3.12.2 project (poetry + venv)
  • src/korban_processor/korban.py — Core types: Korban, ProcessedKorban, OfferingType (OLAH/SHELAMIM/CHATAT/MINCHAH), Provenance (CLAUDE/MISTRAL/GPT/LLAMA/GEMMA/HUMAN), process_korban() pipeline entry
  • src/korban_processor/semichah.py — Provenance tagging. Associates input with source. Rejects empty/anonymous input.
  • src/korban_processor/shechitah.py — Terminates raw form. Strips: preamble, self-reference, hedging, markdown formatting, sycophancy, closing filler. Five-stage stripping with dedicated functions for each type.
  • src/korban_processor/zerikah.py — Extracts vital content. Keeps: Torah references, Hebrew text, root analysis, insight markers (Rashi, Talmud, gematria, binyan). Records discarded content. Fallback: if nothing qualifies as vital, passes everything through rather than discarding all.
  • src/korban_processor/haktarah.py — Transforms prose to Prolog-compatible propositions: verse/3 for Torah refs, root/2 for Hebrew roots, claim/2 for analytical claims, connection/3 for concept connections.
  • src/korban_processor/router.py — Routes based on offering type. Stateless (kiyyor principle). Returns RoutingResult. No module-level accumulator.
  • src/korban_processor/model_interface.py — Outbound Claude API calls via httpx. Construction §3.4: HTTPS only, model claude-sonnet-4-5-20250929, max_tokens 4096. Raises ValueError if ANTHROPIC_API_KEY not set.
  • src/korban_processor/hebrew_parser.py — Hebrew analysis utilities: nikkud stripping, te'amim stripping, consonant extraction, gematria, root identification (Phase 2: consonant extraction; Phase 3: Shoresh Engine), word splitting.
  • test/__init__.py, test/fixtures.py — Test fixtures with 4 realistic Claude API response samples
  • test/test_semichah.py, test/test_shechitah.py, test/test_zerikah.py, test/test_haktarah.py, test/test_router.py, test/test_hebrew_parser.py, test/test_model_interface.py, test/test_korban.py — Full test suite

BUILD_KORBAN.md Verification Results

Verification Result
1. Shechitah test: strips preamble/markdown/hedging/self-ref, preserves Torah PASS
2. Zerikah test: extracts Torah refs, Hebrew roots, separates vital from discard PASS
3. Haktarah test: Prolog propositions syntactically valid, semantically grounded PASS
4. Statelessness test: no state leaks between sequential offerings PASS
5. Empty offering test: graceful handling, no assistant voice in output PASS
Check Result
pytest total 181 tests, 0 failures
BUILD verification §1 (shechitah) 11 tests PASS
BUILD verification §2 (zerikah) 5 tests PASS
BUILD verification §3 (haktarah) 4 tests PASS
BUILD verification §4 (statelessness) 3 tests PASS
BUILD verification §5 (empty offering) 4 tests PASS
Hebrew gematria: תורה=611, בראשית=913 PASS
Module-level state absent from router PASS
HTTPS enforcement in model_interface PASS

Broken Tablets — What Broke and How It Was Fixed

18. router.py had module-level _routing_log — mutable state between calls

  • Problem: The stub's router.py had a module-level _routing_log: List[RoutingResult] = [] accumulator plus get_routing_log() and clear_routing_log() accessors. This violates the kiyyor principle from structure_not_content.md — "No module-level caches. Each call to process_korban() starts clean."
  • Fix: Removed _routing_log, get_routing_log(), and clear_routing_log(). The route() function returns a RoutingResult directly; callers track results themselves.
  • Lesson: The structure_not_content spec governs architecture, not just content. The kiyyor (laver) resets before each use. A log that accumulates across calls is the system carrying yesterday's offering into today's.

19. Test helper make_processed(propositions=[]) substituted default

  • Problem: In test_router.py, the helper used propositions or [default_list]. Python [] is falsy — an empty propositions list was silently replaced with the default non-empty list.
  • Fix: Changed to props = _DEFAULT_PROPOSITIONS if propositions is None else propositions.
  • Lesson: Use if x is None not or when distinguishing "not provided" from "provided but empty".

20. Shechitah test put Torah content inside self-reference sentence

  • Problem: Test had "As an AI language model, I should note that Genesis 1:1 is significant." — the I should note that.*?[.,] pattern correctly strips the whole sentence (including "Genesis 1:1") because .*?[.,] lazily expands to the sentence-ending period. The test expected "Genesis 1:1" to survive.
  • Expected: This is NOT a bug in shechitah — it is correct behavior. A model saying "I should note that X" is self-referential framing wrapping X. The entire sentence is voice, not content.
  • Fix: Changed test to use realistic separate sentences: self-reference sentence with its own period, then Torah content as a separate sentence.
  • Lesson: Shechitah strips at the sentence level when the sentence is self-referential framing. Torah content should stand in its own sentence. Do not test the knife by putting food on the handle.

Design Decisions

Zerikah fallback: If no sentence qualifies as vital, zerikah returns all sentences as vital rather than returning empty. Better to pass through unfiltered content than to discard everything. The empty offering test (BUILD §5) relies on this — even a preamble-only response produces processable output, just with no propositions extracted.

hebrew_parser.py Phase 2 scope: identify_root() returns the first 3 consonants as a candidate root. This is a deliberate approximation — proper morphological analysis (stripping prefixes, doubling, recognizing conjugation patterns) requires the Shoresh Engine (Haskell, Architecture §3.1). The Phase 2 implementation creates the interface without depending on the engine socket. This follows the pattern established in ShoreshEngineClient and TalmudicEngineClient in the Vav Pipeline.

model_interface.py uses httpx directly: Construction §1.4 lists httpx==0.27.0 as a dependency. The anthropic Python SDK is not in the Construction spec. Therefore the Claude API is called directly via httpx, not via the SDK. This is ka'asher tzivah — use what the spec specifies.


Session: 2026-02-24 (continued) — Sanhedrin Defect Fix

Broken Tablets — What Broke and How It Was Fixed

17. rejected outcome unreachable in panel:determine_outcome/3

  • Problem: determine_outcome/3 always returned accepted when there was a majority, regardless of what the majority voted. The rejected outcome from Construction spec §3.2 (outcome => accepted | rejected | teiku) could never occur. compute_majority_minority/1 did not include the majority's verdict in its output map.
  • Fix: (1) Added verdict => MajSample#vote.verdict to both majority and minority maps in compute_majority_minority/1. (2) Rewrote determine_outcome/3 to check maps:get(verdict, Majority, abstain) — accept → accepted, reject → rejected, abstain → teiku.
  • Test: Added 7 new tests: majority_verdict_accept_test, majority_verdict_reject_test, determine_outcome_accepted_test, determine_outcome_rejected_test, determine_outcome_teiku_no_votes_test, determine_outcome_teiku_all_abstain_test, determine_outcome_suspicion_overrides_test. All 48 tests pass.
  • Lesson: Every output state in the spec must be reachable. If a type says accepted | rejected | teiku, write tests that exercise all three. The unreachable code path is a spec violation hiding as a type declaration.