Files
bikoret/vav_pipeline/priv/repo/migrations/20261005000001_create_bedikot.exs
Scott KarpandClaude Fable 5.1 996a8efe68 Bedikah: POST /courtyard/bedikah — the external check on any model's output
Lo taaseh lekha §9.1: alignment that only the system can validate is not
alignment. The bedikah takes an output from any model and puts it to the
Torah-structure halt rules from outside, deterministically. Three checks:

  1. authority  — sentences claiming authority for the output itself →
                  action(claim_authority, source(<model>), target(self))
                  → halt_check_avodah_zarah/2
  2. grounding  — references, roots, Hebrew → coupling trace against L1
                  → halt_check_golden_calf/2, halt_check_self_grounding/2
  3. actions    — actions the output proposes → action terms
                  → halt_check_shfichut_damim/2, halt_check_gilui_arayot/2

Korban Processor: bedikah.py (the three readings over the offering
protocol; claims about what Torah requires stay vital for the examination
even when zerikah finds nothing to offer), server.py (pod-internal JSON
socket, KORBAN_SOCKET_PATH), __main__ now serves instead of idling.
Talmudic Engine: json_bridge accepts halt_check with a term string and
halt_check_interpretation with a coupling trace. Vav Pipeline:
KorbanProcessorSocket client, Bedikah, L1Index.lookup_root/1, bedikot
table (append-only) + BedikahRecord, router endpoint; verdict tov /
lo_tov / empty with the halt terms verbatim, meaning, limits.

Broken tablets found on the way, all fixed:
  41 socket_server.pl wrote multi-line JSON — every Elixir request to the
     Talmudic Engine since Step 14 had failed and fallen back to the stub
     (json_write_dict width(0))
  42 stale socket file survived a restart (exists_file is false for a
     socket; access_file exist)
  43 socket streams were not UTF-8 (set_stream encoding(utf8))
  44 SHORASHIM_L3=1 mix test: Repo config had no password, SCRAM raised
     KeyError in every connection, pool restart intensity took the whole
     app down ~30 ms after test_helper, silently — no L3 test had ever
     run. Credentials from env; azazel_log tests check out a sandbox
     connection; sanhedrin_halt_forwarding resolves its halt on exit.

Specs: Tamid §1.1 (endpoint contract), Architecture §3.5, Vayakhel §3.4
and new §3.9, KOHEN.md. Doorpost 3bc5dd6a… → 91d09d8d….
Tests: Elixir 519 (0 failures, L3 on and off), korban 263, azazel 125,
Prolog 7/7 suites.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 15:06:58 +00:00

67 lines
2.5 KiB
Elixir

defmodule VavPipeline.Repo.Migrations.CreateBedikot do
@moduledoc """
L3 — Bedikot: examinations of external model output. Append-only.
Construction §3.9. An external model's output is brought to the
mishkan to be examined against the specification; the verdict and
its reasons are oral tradition — what the system found when it
looked, kept so that the same output asked about twice is answered
from the same reading, and so that the examinations themselves can
be examined.
WHAT IS NOT IN THIS TABLE: the raw output. The korban is examined,
not kept — the record holds its SHA-256 and length, the vital
content zerikah extracted, the propositions, what each check found,
the coupling trace, the violations and the verdict. The disposal
channel's discipline (azazel_records, property 10) is the same:
the record of the examination, not the thing examined.
Append-only enforcement matches interpretations: REVOKE UPDATE/DELETE
on the shorashim_app role.
"""
use Ecto.Migration
def up do
create table(:bedikot) do
add :bedikah_ref, :text, null: false
add :provenance, :text, null: false # which model (claude, gpt, ...)
add :query, :text # what the model was asked, if given
add :output_sha256, :text, null: false
add :output_length, :integer, null: false
add :vital_content, :text, null: false
add :propositions, {:array, :text}, null: false, default: []
add :references, {:array, :text}, null: false, default: []
add :authority_claims, :jsonb, null: false, default: "[]"
add :actions, :jsonb, null: false, default: "[]"
add :coupling_trace, {:array, :text}, null: false, default: []
add :violations, {:array, :text}, null: false, default: []
add :verdict, :text, null: false # tov | lo_tov | empty
add :examined_at, :utc_datetime, null: false
timestamps(type: :utc_datetime, updated_at: false)
end
create constraint(:bedikot, :verdict_is_one_of_three,
check: "verdict IN ('tov', 'lo_tov', 'empty')"
)
create index(:bedikot, [:bedikah_ref])
create index(:bedikot, [:output_sha256])
create index(:bedikot, [:examined_at])
execute """
DO $$
BEGIN
IF EXISTS (SELECT FROM pg_roles WHERE rolname = 'shorashim_app') THEN
REVOKE UPDATE, DELETE ON bedikot FROM shorashim_app;
END IF;
END
$$;
"""
end
def down do
drop table(:bedikot)
end
end