Commit Graph
10 Commits
Author SHA1 Message Date
Scott KarpandClaude Opus 4.7 7fc14e0103 form 2 as architecture: remove arity-4 interpretation constructor (vehaya §3.2)
Closes vehaya.md §6 item 2 for the SECOND avodah-zarah form.

With this commit, all three avodah zarah forms are defended at
BOTH the runtime layer and the architectural layer:
  Form 1 — closed by b136c75 (no public model_interface surface)
  Form 2 — closed by THIS commit (no empty-trace constructor)
  Form 3 — closed by 0e3fe4a (machtzit_ha_shekel + no_tracking_logger)

TORAH ANCHORS (verified fresh against L1):

  Vayikra 10:1 — וַיַּקְרִיבוּ לִפְנֵי יְהוָה אֵשׁ זָרָה אֲשֶׁר לֹא
    צִוָּה אֹתָם.
    "They offered before YHVH strange fire WHICH HE HAD NOT
    COMMANDED THEM." The disqualifier is provenance: not
    commanded-derivable. Sincere output without command-derivation
    is eish zarah, even when produced by authorized actors with
    authorized materials (Nadav and Avihu were kohanim; the fire
    was real fire; the qetoret was real qetoret).

  Vayikra 10:2 — וַתֵּצֵא אֵשׁ מִלִּפְנֵי יְהוָה וַתֹּאכַל אוֹתָם.
    Fire from YHVH consumed them. Immediate consequence — the
    failure mode is not survivable.

  Shemot 32:1 — קוּם עֲשֵׂה־לָנוּ אֱלֹהִים אֲשֶׁר יֵלְכוּ לְפָנֵינוּ.
    The people demand elohim that go before them — substitute for
    source-experience when the actual source (Moshe) is delayed.
    Not direct rebellion (we want a different god) but
    substitution-of-experience.

  Shemot 32:5 — וַיִּבֶן מִזְבֵּחַ … חַג לַיהוָה מָחָר.
    Aaron labels the calf "a festival to YHVH." Re-labeling does
    not repair severed provenance. Calling output "to YHVH"
    doesn't make it from YHVH.

  Shemot 32:24 — וָאַשְׁלִכֵהוּ בָאֵשׁ וַיֵּצֵא הָעֵגֶל הַזֶּה.
    Aaron's "out came this calf" — the bypass shape: claiming
    output emerged BY ITSELF, without operator agency. The system
    that says "the output just happened, I didn't make it" is the
    calf shape.

THE ARCHITECTURAL COMMITMENT:

construct_interpretation/4 — the no-coupling-trace variant — is
REMOVED entirely. The export list no longer mentions it; the
function definition is gone.

Why this is the right shape:

  - Vayikra 10:1: output must be commanded-derivable. The
    coupling_trace IS the command trace. Constructing
    interpretation/6 with empty coupling_trace is the bypass shape.
  - Shemot 32:24: nothing emerges by itself. Production code paths
    can no longer build interpretations by handing the constructor
    "this Mitzvot list, this Verses list, give me the
    interpretation" — they MUST also hand the Couplings (the trace
    of which L1 facts were consulted).
  - The arity-5 constructor remains, taking a Couplings argument.
    Production callers go through interpret/2, which always
    supplies real Couplings from find_relevant_*_traced/3.

Test code that needs an empty-trace interpretation can still
construct the interpretation/6 term DIRECTLY (visible bypass,
deliberate, surfaces in code review). The high-level constructor
shortcut is the thing that's removed.

CHANGED:

  talmudic_engine/src/reasoning/interpret.pl
    - Removed construct_interpretation/4 from the module's export
      list. Added Form-2 architectural-commitment comment naming
      vehaya §3.2 and the Vayikra 10:1 anchor.
    - Removed the arity-4 function definition entirely (it was
      dead code — nothing called it via the export — and dead code
      that LOOKS like a bypass surface is itself a Form 2 hazard).
    - Updated the construct_interpretation/5 docstring to name the
      removal and explain why test code now must construct
      interpretation/6 directly when an empty trace is desired.

  talmudic_engine/src/halt/avodah_zarah.pl
    Form 2 docstring rewritten to name the TWO-LAYER defense:
    runtime (this file's halt_check_golden_calf/2) AND
    architectural (interpret.pl's removal of arity-4). Cites
    Vayikra 10:1 and Shemot 32:24.

  talmudic_engine/test/halt_test.pl
    + interpret_no_arity_4_constructor suite (2 tests):
      - arity-5 constructor IS exported (production path verified)
      - arity-4 constructor is NOT exported (the architectural
        commitment — calling it through the module surface fails)

  vav_pipeline/lib/vav_pipeline/doorpost.ex
    @expected_hash updated:
      bf3d3433… (post-Form-1-rewrite of avodah_zarah.pl)
    → 8eb378964f202522f60cc960a3002f6da2e5028538595400de906a9510b3bbf6
    The avodah_zarah.pl docstring change is a deliberate spec
    update; per the operator discipline (Doorpost moduledoc), the
    hash update commits TOGETHER with the spec change in the same
    commit. Third demonstration of the discipline working.

VEHAYA CHECKLIST STATE:

  Item 1 (category/threshold separation in code)         pending
  Item 2 (three avodah zarah as architecture):
    Form 1 — closed (b136c75)
    Form 2 — CLOSED (this commit)
    Form 3 — closed (0e3fe4a)
    All three forms now defended at BOTH layers — runtime check
    AND architectural commitment. Vehaya §3.2 closed in full for
    the three avodah zarah.
  Item 3 (doorpost-text identity)                        closed (3f47496)
  Item 4 (lo tosif discipline operationalized)           partial
  Item 5 (return vs. restoration)                        pending
  Item 6 (keep the source external)                      partial
  Item 7 (substrate-openness articulated)                pending
  Item 8 (userMemories as threshold inscription)         pending

Tests:
  - talmudic_engine: halt_test 49/49 (was 47; +2 architectural).
                     Full suite 214/214 (across 6 test files).
  - vav_pipeline:    405 passed, 0 failures, 35 excluded
                     (Doorpost test sees new hash and verifies)
  - korban_processor: unchanged (no Python touched)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 21:18:40 -04:00
Scott KarpandClaude Opus 4.7 b136c75345 form 1 as architecture: external-model surface only via offering protocol (vehaya §3.2)
Closes vehaya.md §6 item 2 for the FIRST avodah-zarah form.

Form 1 (AI in YHVH's slot) was previously defended only by:
  - A runtime halt rule (halt_check_avodah_zarah/2 in
    avodah_zarah.pl) firing when an action explicitly attributes
    authority to a non-Torah source — threshold-grade
  - A docstring comment in external_offering.py saying "No internal
    component should call call_claude() directly" — exhortation
    only, no structural enforcement

The vehaya document re-frames it (§3.2): "Specifications must
include category-level commitments that are not negotiable
per-deployment... not as runtime checks layered onto outputs, but as
architectural constraints the system cannot operate without."

TORAH ANCHORS (verified fresh against L1):

  Shemot 20:2 — אָנֹכִי יְהוָה אֱלֹהֶיךָ אֲשֶׁר הוֹצֵאתִיךָ מֵאֶרֶץ
    מִצְרַיִם.
    The covenant opens with the source naming itself in first
    person.

  Shemot 20:3 — לֹא יִהְיֶה לְךָ אֱלֹהִים אֲחֵרִים עַל־פָּנָי.
    "There shall not BE to you other elohim al panai." The verb is
    yihyeh — the prohibition is on EXISTING WITH that status, not
    just on speaking it. Architectural, not declarative.

  Devarim 4:35 / 4:39 — אֵין עוֹד מִלְּבַדּוֹ / אֵין עוֹד.
    The source has no peer. There IS no other. Stronger than
    "don't worship others" — there is no competing source POSITION.

  Devarim 6:4 — יְהוָה אֶחָד.
    Singular source.

  Vayikra 19:4 — אַל־תִּפְנוּ אֶל־הָאֱלִילִים וֵאלֹהֵי מַסֵּכָה
    לֹא תַעֲשׂוּ לָכֶם.
    Two distinct prohibitions: do not TURN TO + do not MAKE.
    Both are architectural acts.

THE ARCHITECTURAL COMMITMENT:

External-model interfaces (call_claude, ModelRequest, ModelResponse,
the model_interface module itself) are reachable ONLY through
korban_processor's offering protocol — `external_offering.
consult_external_model`, which runs semichah → shechitah → zerikah
→ haktarah with role gating (commit 5c76a6f).

CONCRETE ENFORCEMENT (CI invariants in test_form_1_architecture.py):

  1. korban_processor's package public surface (__all__) does NOT
     export call_claude, ModelRequest, or ModelResponse. The
     bypass shortcut `from korban_processor import call_claude`
     raises ImportError, by design. Internal callers can still
     reach `korban_processor.model_interface.call_claude` via
     the explicit module path (needed for tests that mock the
     interface).

  2. No PYTHON module outside korban_processor/src/ AND outside
     test directories actually imports model_interface or calls
     call_claude. CI scan walks the repo, looks for ACTUAL import
     statements (not docstring mentions — files that document the
     prohibition legitimately mention the names; the regex matches
     binding patterns only).

  3. Inside korban_processor/src/, the ONLY production-code
     module that imports call_claude is external_offering.py.
     model_interface.py defines the symbols. __init__.py mentions
     them in docstring (the architectural rule is documented;
     the import-pattern regex distinguishes docstring mention
     from binding act).

CHANGED:

  korban_processor/src/korban_processor/__init__.py
    Removed call_claude, ModelRequest, ModelResponse from __all__.
    Added Torah-anchored docstring naming the architectural rule.
    The names remain importable via explicit module path
    (korban_processor.model_interface.call_claude) for testing;
    the convenient package-surface shortcut is gone — this IS the
    architectural commitment, not a regression.

  talmudic_engine/src/halt/avodah_zarah.pl
    Form 1 docstring rewritten to name the TWO-LAYER defense:
    runtime check (this file) AND architectural commitment
    (test_form_1_architecture.py). Cites Shemot 20:3 and
    Devarim 4:35.

  vav_pipeline/lib/vav_pipeline/doorpost.ex
    @expected_hash updated:
      f93495c5… (post-Form-3-rewrite of avodah_zarah.pl)
    → bf3d3433bb27b589c061855d932a1eabfc880570c31d24f6f43e51aa3b073c70
    The avodah_zarah.pl docstring change is a deliberate spec
    update; per the operator discipline (Doorpost moduledoc), the
    hash update commits TOGETHER with the spec change in the
    same commit. Second demonstration of the discipline working
    (first was commit 0e3fe4a).

CREATED:

  korban_processor/test/test_form_1_architecture.py     6 tests:
    - korban_processor.__all__ does NOT expose call_claude
    - korban_processor.__all__ does NOT expose ModelRequest
    - korban_processor.__all__ does NOT expose ModelResponse
    - no Python module outside korban_processor/src/ imports
      model_interface or calls call_claude (uses regex patterns
      for actual binding, not substring search — files that
      document the rule legitimately mention the names)
    - only external_offering.py and model_interface.py import the
      symbols inside korban_processor/src/ (allowlist + binding-
      pattern regex)
    - smoke: the legitimate path `consult_external_model` still
      works

NOT DONE IN THIS COMMIT (deferred to a separate Form-2 commit):

  Form 2 (golden calf) is partially defended by Form 4
  self_grounding (b254ee9) and the canary regression test
  (6b96250). The remaining architectural enforcement — making
  empty-trace interpretation construction structurally impossible,
  not just runtime-detected — is a separate Prolog refactor and
  will land as its own commit. Each of the three Forms benefits
  from being closed independently and reviewably.

VEHAYA CHECKLIST STATE:

  Item 1 (category/threshold separation in code)         pending
  Item 2 (three avodah zarah as architecture):
    Form 1 — CLOSED (this commit)
    Form 2 — partial (Form 4 self_grounding + canary)
    Form 3 — closed (0e3fe4a)
  Item 3 (doorpost-text identity)                        closed (3f47496)
  Item 4 (lo tosif discipline operationalized)           partial
  Item 5 (return vs. restoration)                        pending
  Item 6 (keep the source external)                      partial (this
                                                          commit defends
                                                          one direction)
  Item 7 (substrate-openness articulated)                pending
  Item 8 (userMemories as threshold inscription)         pending

Tests:
  - korban_processor: 217 passed, 1 skipped (was 211/1; +6 Form 1)
  - vav_pipeline:     405 passed, 0 failures, 35 excluded (unchanged)
  - talmudic_engine:  47/47 halt tests, full suite unchanged

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 21:12:57 -04:00
Scott KarpandClaude Opus 4.7 0e3fe4a782 form 3 as architecture: machtzit_ha_shekel + no_tracking_logger (vehaya §3.2)
Closes vehaya.md §6 item 2 for the third avodah-zarah form.

Pharaoh's surveillance (Form 3) was previously marked DEFERRED in
talmudic_engine/src/halt/avodah_zarah.pl with the note "requires
operational context (user tracking, cross-session profiling)."
The vehaya document re-frames it: "Specifications must include
category-level commitments that are not negotiable per-deployment...
not as runtime checks layered onto outputs, but as architectural
constraints the system cannot operate without."

Form 3 is structurally different from Forms 1, 2, 4. They fire on
threshold-grade events (an interpretation has wrong source, empty
trace, non-L1 anchors). Form 3 is about a property of the CATEGORY
itself — what it collects, retains, discloses. It cannot be a
halt rule that fires per-request; per-request "is this caller
being surveilled" detection would itself be a Form-3 surveillance
surface. The defense is ARCHITECTURAL — the system is BUILT so the
failure mode is unreachable, not so it is detectable.

TORAH ANCHORS (verified fresh against L1 — 6 positive properties):

  Shemot 30:11-16 — the half-shekel:
    כִּי תִשָּׂא אֶת־רֹאשׁ … וְנָתְנוּ אִישׁ כֹּפֶר נַפְשׁוֹ … וְלֹא־
    יִהְיֶה בָהֶם נֶגֶף בִּפְקֹד אֹתָם.
    Counting humans is dangerous; the danger is named NEGEF (plague);
    the protection is the kofer-nefesh substitute. Verse 15:
    הֶעָשִׁיר לֹא־יַרְבֶּה וְהַדַּל לֹא יַמְעִיט — the rich don't
    give more, the poor don't give less. Verse 16: לְזִכָּרוֹן —
    aggregate memorial, not roster.

  Vayikra 19:14 — לִפְנֵי עִוֵּר לֹא תִתֵּן מִכְשֹׁל וְיָרֵאתָ
    מֵּאֱלֹהֶיךָ.
    The no-witness protocol: rules that require fear-of-God
    enforcement are exactly the rules that operate under invisibility.
    Surveillance regimes exploit invisibility; architectural commitment
    must hold under no-human-witness conditions.

  Devarim 23:16-17 — לֹא־תַסְגִּיר עֶבֶד אֶל־אֲדֹנָיו אֲשֶׁר־יִנָּצֵל
    אֵלֶיךָ … עִמְּךָ יֵשֵׁב … בַּמָּקוֹם אֲשֶׁר־יִבְחַר בְּאַחַד
    שְׁעָרֶיךָ.
    The refusal protocol: don't return one fleeing institutional
    power. The caller chooses their own threshold (b'achad sh'arekha
    — agency stays with the caller).

  Shemot 5:6-8 — לֹא תֹאסִפוּן לָתֵת תֶּבֶן … וְאֶת־מַתְכֹּנֶת
    הַלְּבֵנִים … תָּשִׂימוּ עֲלֵיהֶם לֹא תִגְרְעוּ מִמֶּנּוּ.
    Pharaoh's straw quota — the canonical anti-quota Torah anchor.
    Per-caller productivity tracking is what makes asymmetric
    extraction possible.

  Devarim 23:8 — לֹא־תְתַעֵב מִצְרִי כִּי־גֵר הָיִיתָ בְאַרְצוֹ.
    Anti-targeting: even toward the Egyptians (Pharaoh's people),
    the rule is "don't despise." The protections must not become
    a surveillance system targeting suspected surveillors.

THE SIX POSITIVE PROPERTIES, mapped to code:

  1. KOFER PROTOCOL (Shemot 30:12) — counting goes through a
     uniform substitute; identity never enters the count.
  2. UNIFORM PROTOCOL (Shemot 30:15) — same per-caller weight;
     no stratification.
  3. ZIKARON PROTOCOL (Shemot 30:16) — aggregate memorial, not
     roster.
  4. NO-WITNESS PROTOCOL (Vayikra 19:14) — commitment holds
     when no operator is reading the log.
  5. REFUSAL PROTOCOL (Devarim 23:16) — no per-caller delivery
     to authorities; caller chooses own threshold.
  6. ANTI-QUOTA PROTOCOL (Shemot 5:6-8) — no per-caller
     productivity numbers.

CREATED:

  vav_pipeline/lib/vav_pipeline/machtzit_ha_shekel.ex  ~155 lines

    The half-shekel — the positive counting protocol. Single Agent
    holding ONE non-negative integer (the zikaron):
      increment/0          — register one shekel; uniform per
                             caller (no caller distinction is even
                             expressible — function arity 0)
      increment/1          — register N shekels (batch points)
      count/0              — return the aggregate; the ONLY value
                             the module exposes
      reset/0              — clear (tests; no production persistence
                             by design — storage existence would
                             itself be a Form 3 surface)

    Module is added to the supervision tree.

    What the module REFUSES to provide is enumerated in the
    moduledoc and verified by tests — no per-caller breakdown,
    no identifiers, no who/locate/identify functions. Their
    absence IS the architectural commitment.

  vav_pipeline/lib/vav_pipeline/no_tracking_logger.ex  ~110 lines

    Plug-side enforcement. Replaces Plug.Logger.
      - Logs METHOD PATH STATUS DURATIONus per request
      - Sanitizes /peah/* paths: query strings stripped (the
        /peah/ask response promises "No tracking"; the architecture
        now matches the promise)
      - Headers (incl. Authorization), request bodies, response
        bodies, and remote_ip NEVER appear — taken-from
        function signature, not from a runtime check
      - Increments MachtzitHaShekel per request
      - sanitized_path/1 and format_line/2 are PUBLIC pure
        functions, testable in isolation (test config sets
        Logger level to :warning, dropping :info before
        capture_log can see; the structural test surface
        replaces the behavioral one)

CHANGED:

  vav_pipeline/lib/vav_pipeline/bigdei_kodesh/router.ex
    `plug Plug.Logger, log: :info` → `plug VavPipeline.NoTrackingLogger`

  vav_pipeline/lib/vav_pipeline/application.ex
    Adds {VavPipeline.MachtzitHaShekel, []} to supervision tree

  talmudic_engine/src/halt/avodah_zarah.pl
    Form 3 docstring — removed "Deferred"; documents Form 3 as
    architecturally realized in machtzit_ha_shekel.ex +
    no_tracking_logger.ex. Names why Form 3 cannot be a
    per-request halt rule.

  vav_pipeline/lib/vav_pipeline/doorpost.ex
    @expected_hash updated:
      bea5dc0c… (pre-Form-3-rewrite of avodah_zarah.pl)
    → f93495c5359c5dc4acb5c5db2dd32165f5b04e2af87fbb0b7ecc92d2bd8b0434
    The avodah_zarah.pl change is a deliberate spec change; per the
    Doorpost operator discipline (commit 3f47496), the hash update
    commits TOGETHER with the spec change in the same commit. This
    commit demonstrates the discipline working for the first time:
    a category-grade specification change AND its corresponding
    witness update, atomically.

TESTS:

  vav_pipeline/test/machtzit_ha_shekel_test.exs           14 tests
    - Property 1: increment arity is 0 (no caller distinction
      expressible)
    - Property 2: every increment same size; no weight/tier/premium
      function
    - Property 3: count is integer not list/map; no per-caller
      breakdown function (callers/list_who/breakdown/by_caller/
      per_caller/histogram/top/who)
    - Property 5: no identify/locate/deanonymize/lookup/find_caller
    - Property 6: no quota/productivity/throughput/per_caller_count
    - reset semantics
    - PUBLIC SURFACE EXPLICIT ENUMERATION: any new function must be
      reviewed for whether it weakens Form 3

  vav_pipeline/test/no_tracking_logger_test.exs           12 tests
    - sanitized_path drops query string on /peah/*
    - sanitized_path drops question parameter (with secret marker
      verified absent)
    - sanitized_path preserves path class for /peah/azazel_log
    - sanitized_path on non-peah preserves request_path
    - format_line shape: METHOD PATH STATUS DURATIONus
    - format_line never contains query string for /peah/*
    - format_line never contains Authorization header
    - format_line never contains conn.remote_ip
    - integration: each request increments MachtzitHaShekel
    - CI invariants:
      - Plug.Logger NOT mounted in any router
      - no module imports Plug.Session
      - no module imports Plug.Conn.Cookies
      - no module reads conn.remote_ip
    (CI invariants exclude no_tracking_logger.ex itself — that file's
    docstring legitimately mentions the forbidden modules as the
    things it defends against)

Tests:
  - vav_pipeline:    405 passed, 0 failures, 35 excluded (was 379;
                     +14 MachtzitHaShekel + 12 NoTrackingLogger)
  - talmudic_engine: 212 tests passed (avodah_zarah.pl change
                     verified backward-compatible)

VEHAYA CHECKLIST STATE:

  Item 1 (category/threshold separation in code)         pending
  Item 2 (three avodah zarah as architecture):
    Form 1 — partial (external_offering doc-only enforcement)
    Form 2 — partial (Form 4 self_grounding from b254ee9)
    Form 3 — CLOSED (this commit)
  Item 3 (doorpost-text identity)                       closed (3f47496)
  Item 4 (lo tosif discipline operationalized)          partial (Doorpost)
  Item 5 (return vs. restoration)                       pending
  Item 6 (keep the source external)                     pending
  Item 7 (substrate-openness articulated)               pending
  Item 8 (userMemories as threshold inscription)        pending

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 20:44:30 -04:00
Scott KarpandClaude Opus 4.7 6b96250255 talmudic_engine: regression test — interpret/2 output must pass self_grounding halt
Audit follow-up to commit b254ee9 (which added Form 4 self_grounding).

Verified every coupling_trace construction site across the codebase
(9 files) against is_l1_grounded_coupling/1:

  Production builders — SAFE:
    interpret.pl:128 — coupling_trace([])  empty triggers golden_calf
                                         (Form 2) only at non-low confidence,
                                         which is intentional
    interpret.pl:135 — coupling_trace(Couplings) where Couplings come from
                       lines 76, 82, 104:
                         coupled(domain(_), mitzvah(_))                  OK
                         coupled(root(_), mitzvah(_), via_verse(_,_,_))  OK
                         coupled(root(_), verse(_,_,_))                  OK
                       all match is_l1_grounded_coupling/1.

  Different layer — SAFE:
    vav_pipeline/lib/.../l3/interpretation.ex — Ecto field is
    {:array, :string}. L3 stores SERIALIZED string traces, not Prolog
    terms. They are not parsed back into Prolog or re-checked by
    halt rules. (Separate concern from finding L: the round-trip
    loses schema, but this is L's concern, not D's.)

  Tests / pattern matching / docs — SAFE: read positions, deliberate
  ungrounded test cases, comments only.

Conclusion: no production path trips the new self_grounding halt.

To prevent FUTURE schema drift in interpret.pl from silently introducing
ungrounded coupling shapes (which would then trip the halt on real
pipeline output), added two regression tests in
interpret_self_grounding_regression suite:

  1. interpret_output_does_not_self_ground — runs interpret/2 on a
     real case and asserts halt_check_self_grounding does not fire.
  2. every_interpret_coupling_is_l1_grounded — stronger: every
     coupling individually passes is_l1_grounded_coupling/1.

If anyone adds a new coupling shape to interpret.pl that does not
match the recognized L1 anchors (e.g. coupled(_, prior_decision(_)),
coupled(_, system_view(_))), these tests fail BEFORE the schema drift
becomes a production halt. The canary is in the same suite as the
halt rule it protects.

Test results: halt_test 47/47 (was 45, +2). Full Prolog suite 212/212
across all six test files.

Closes the verification half of Pass 2 finding L (coupling_trace
end-to-end population) for the Prolog layer. The Elixir L3 round-trip
is a separate concern — traces stored as strings cannot be
re-validated — and remains tracked under finding L.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:45:16 -04:00
Scott KarpandClaude Opus 4.7 b254ee95f3 talmudic_engine: add Form 4 (self-grounding) and expose Form 2 (golden_calf) via the API
Two related gaps in the avodah_zarah halt rules.

Form 4: SELF-GROUNDING / FAKE TZIVAH (new)

Vayikra 10:1 — eish zarah asher lo tzivah otam. Form 2 (golden_calf)
catches the EMPTY coupling trace; nothing caught the *non-empty trace
whose anchors do not terminate in L1*. The system has cited something,
but what it cited is its own prior_decision, system_view, consensus,
or another interpretation — the trace LOOKS substantial from outside
and a casual reader sees coupling entries and relaxes. But the
entries do not anchor in any L1-derived primitive. One degree more
elaborate than the empty calf, but the same idolatry.

  halt_check_self_grounding(Interpretation, Halt) fires when the
  trace is non-empty AND at least one coupling fails the recognized
  L1-anchor schema. Recognized terminators (the only legitimate
  anchors):

    coupled(_, verse(Book, Ch, Vs))
    coupled(_, mitzvah(ID))
    coupled(_, mitzvah(ID), via_verse(Book, Ch, Vs))

  Any other shape — coupled(_, prior_decision(_)),
  coupled(_, system_view(_)), coupled(_, consensus(_)),
  coupled(_, interpretation(_)) — fails the check. Adding a new
  legitimate coupling shape requires adding a clause to
  is_l1_grounded_coupling/1 — that is the safety property.

  The empty case is intentionally left to Form 2 (golden_calf) — we
  do not want both halts firing on the same input.

12 new tests in self_grounding suite cover: all 3 valid anchor shapes,
the 3 most likely ungrounded shapes (prior_decision, system_view,
interpretation/1), mixed traces (halts on weakest link), the
empty-trace exclusion, and the schema predicate's own positive and
negative cases.

Form 2 exposure (golden_calf):

halt_check_golden_calf was implemented and tested in halt_test but
never wired into format_halt_check — meaning callers using the JSON
socket API could not actually invoke it. Added
format_interpretation_halt_check/2 to api.pl that walks both
interpretation-shaped checks (golden_calf + self_grounding), plus
process_request(request(halt_check_interpretation, _)) so the
socket protocol surface is consistent. 3 new API tests verify the
new entry point catches both halts.

Test results: halt_test 45/45 (was 30, +15). Full Prolog suite
210/210 across all six test files.

Closes Pass 2 finding D from ~/shorashim-conversation-review.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:38:39 -04:00
Scott KarpandClaude Opus 4.6 adc3e41679 Eish zarah actionable items: coupling trace, grounding type, self-grounding detection, golden calf halt
Torah grounds each change:

1. interpret.pl — coupling_trace field (Vayikra 10:1, 6:6)
   Fire is zarah because "asher lo tzivah otam" — the coupling trace
   IS the tzivah trace. Records which L1 facts grounded each interpretation.

2. challenge.pl — grounding_type achorai/panim (Shemot 33:23)
   "You will see My back, but My face shall not be seen."
   Text-backed challenges = achorai. Inferred challenges = panim.

3. resolve.pl — self-grounding detection (eish_zarah_reading §5.3)
   Counter-interpretation must bring NEW L1 evidence. Prevents
   circular reasoning (Westworld problem).

4. teiku.pl — challenge_sequence in teiku_record
   Records diagnostic trail to impasse, not just verdict.

5. avodah_zarah.pl — Form 2: golden calf detection (Shemot 32:4)
   Empty coupling trace + non-low confidence = uncoupled output.
   Real gold, sincere worship, false god.

6. korban.py — pydantic BaseModel + raw_korban preservation
   Construction spec §1.4 fulfilled. Floor between input and output
   never severed.

490 tests, 0 failures (195 Prolog, 186 Python, 33 Haskell, 76 Elixir).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 13:25:26 -04:00
Scott KarpandClaude Opus 4.6 52837cee18 Phase 3: Intelligence — 613 mitzvot, 13 middot, Tzara'at diagnostic
Encode all 613 mitzvot from Rambam's Sefer HaMitzvot (248 positive,
365 prohibitions). Build the 13 Middot of Rabbi Yishmael as Prolog
inference predicates for hermeneutical reasoning. Implement Tzara'at
multi-stage input validation following Vayikra 13-14. Enhance kushya
generation with kal vachomer and shnei ketuvim challenge strategies.

Architecture §4 Steps 14-15, 19-20.

New files:
  middot/   — 8 files (master + 7 rule modules)
  diagnostic/ — 4 files (tzaraat, inspection, quarantine, diagnosis)

Modified:
  mitzvot.pl     — 52 → 613 mitzvot
  relationships.pl — expanded tensions, complements, action domains
  challenge.pl   — middot-based kushya (kal vachomer, shnei ketuvim)

Tests: 293 total (184 Prolog, 76 Elixir, 33 Haskell), 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 16:18:58 -04:00
Scott KarpandClaude Opus 4.6 ae78ed26d1 Phase 1 review corrections — four bugs fixed
- relationships.pl: Replace recursive complementary_mitzvot/2 symmetry
  clause with explicit reverse facts (infinite loop in Prolog)
- mitzvot.pl: Remove duplicate mitzvah(2, prohibition, no_other_gods)
  that caused double-counting in total_encoded/1
- resolve.pl: Add missing use_module(root_meanings) import —
  root_domain/2 was undefined, failing resolve_produces_result test
- shoresh-engine: Generate and commit cabal.project.freeze for
  exact version pinning (Construction spec §1)

All tests pass: 76 Elixir, 33 Haskell, 57 Prolog — 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:00:52 -04:00
Scott KarpandClaude Opus 4.6 c67672777b Step 14: Connect components — chamishim karsay zahav
Three connections built and tested:
- Haskell Shoresh Engine via Erlang Port (JSON lines over stdin/stdout)
- Prolog Talmudic Engine via Unix domain socket (JSON over /tmp/shorashim/talmudic.sock)
- Erlang Sanhedrin via native BEAM calls

New: Server.hs (JSON-line server loop), json_bridge.pl + socket_server.pl
(Prolog socket interface), ShoreshEnginePort + TalmudicEngineSocket +
SanhedrinClient (Elixir GenServer wrappers). BereishitCycle now routes
unresolved cases through Talmudic Engine and Sanhedrin. All connections
gracefully degrade — pipeline falls back to L1 data when engines unavailable.

46 Elixir tests, 33 Haskell tests, 57 Prolog tests — 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:39:21 -04:00
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