feat(corpus): corpus redesign — eliminate halacha queue, verified-by-citation layer, rank-at-retrieval (#153)
Implements chaim's 2026-06-20 directive (5 steps; step 6 deferred): 1. No review queue — HALACHA_NO_REVIEW_QUEUE=true (auto-approve all → background); migration cleared 2,416 pending_review → approved. 2. Verified layer — halachot.verified/cite_count from chair citations (db.refresh_verified_layer + scripts/build_verified_layer.py runs citator on ALL committee decisions). 2,775 verified / 137 precedents. 3. Retrieval ranks verified ≫ background — HALACHA_VERIFIED_BOOST in both semantic + lexical halacha queries; filter now includes background (<> rejected). 5. Disabled destructive panel cap/novelty — HALACHA_PANEL_REGIME_ENABLED=false (8508/1049/1200 proved it lost 22-30 genuine principles incl. Lustrenik). 4. Ingest contract — going-forward already queues metadata; backfill_practice_area.py + 206 re-queued to the metadata drain. Source of truth: docs/precedent-corpus-redesign/00-final-synthesis.md. Quality flags are 97% false-positive (nli-audit) → no longer gate. UI queue removal → Claude Design gate. 429 tests green (no regressions). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,23 @@ HALACHA_AUTO_APPROVE_THRESHOLD = float(
|
||||
os.environ.get("HALACHA_AUTO_APPROVE_THRESHOLD", "0.80")
|
||||
)
|
||||
|
||||
# Corpus redesign (#153, chaim 2026-06-20): ELIMINATE the halacha review queue.
|
||||
# When on (default), extraction never produces 'pending_review' — every extracted
|
||||
# principle lands as 'approved' = available BACKGROUND (no human review, ever).
|
||||
# Trust/ranking comes from chair citation (halachot.verified/cite_count), not from
|
||||
# an approval gate. The nli-audit found the quality flags are 97% false-positive,
|
||||
# so gating on them only created a phantom backlog (2,402 items). Set false to
|
||||
# restore the legacy confidence+flags auto-approve gate.
|
||||
HALACHA_NO_REVIEW_QUEUE = os.environ.get("HALACHA_NO_REVIEW_QUEUE", "true").lower() == "true"
|
||||
|
||||
# Corpus redesign (#153): retrieval ranks VERIFIED (chair-cited) principles above
|
||||
# the unranked BACKGROUND. Added to the halacha similarity score (cosine 0-1): a flat
|
||||
# boost if the source precedent was chair-cited, plus a small per-citation increment
|
||||
# (capped). 0 disables (pure similarity). Tunable; calibrate against the canon.
|
||||
HALACHA_VERIFIED_BOOST = float(os.environ.get("HALACHA_VERIFIED_BOOST", "0.12"))
|
||||
HALACHA_CITE_BOOST_PER = float(os.environ.get("HALACHA_CITE_BOOST_PER", "0.01"))
|
||||
HALACHA_CITE_BOOST_CAP = int(os.environ.get("HALACHA_CITE_BOOST_CAP", "10"))
|
||||
|
||||
# ── Tri-model panel extraction regime (legal-principles-redesign, #152) ──────
|
||||
# chaim 2026-06-19: replace single-model auto-approve with a 3-model panel that
|
||||
# deep-analyzes each decision. 3 models (Claude local + DeepSeek + Gemini) each
|
||||
@@ -179,10 +196,13 @@ HALACHA_PANEL_MAX_NEW = int(os.environ.get("HALACHA_PANEL_MAX_NEW", "5"))
|
||||
# a floor misses genuine cross-model agreement → undercounts votes → over-culls.
|
||||
# Calibrate against the gold-set in Phase C before the production cull.
|
||||
HALACHA_PANEL_MATCH_COSINE = float(os.environ.get("HALACHA_PANEL_MATCH_COSINE", "0.80"))
|
||||
# When on (default), extraction uses the decision-level 3-model panel regime above
|
||||
# instead of the legacy per-chunk single-model auto-approve. Set false to fall back
|
||||
# to the legacy path (e.g. if all three judges are unreachable).
|
||||
HALACHA_PANEL_REGIME_ENABLED = os.environ.get("HALACHA_PANEL_REGIME_ENABLED", "true").lower() == "true"
|
||||
# DEFAULT OFF (#153, chaim 2026-06-20). The panel regime caps extraction to MAX_NEW
|
||||
# and filters by novelty — empirically PROVEN destructive (8508/1049/1200 each lost
|
||||
# 22-30 genuine principles incl. the core Lustrenik rule). The corpus redesign keeps
|
||||
# ALL extracted principles as an unranked BACKGROUND layer (trust comes from chair
|
||||
# citation, not extraction); so extraction reverts to the legacy rich per-chunk path.
|
||||
# The panel code is retained (dormant) for optional dedup, never for capping.
|
||||
HALACHA_PANEL_REGIME_ENABLED = os.environ.get("HALACHA_PANEL_REGIME_ENABLED", "false").lower() == "true"
|
||||
|
||||
# Importance layer (#153) — principle-level gold matching. OUR_CHAIR's citations
|
||||
# (tier-1 gold, protective) vs other chairs' (tier-2 weight). Match threshold: a
|
||||
|
||||
Reference in New Issue
Block a user