Prevent schema sprawl by enforcing domain scope on schema proposals. New fields and types
must be relevant to neuroscience, scientific discovery, or the SciDEX platform. An LLM
evaluator assesses proposals for scope compliance before they reach voting.
evaluate_scope(proposal) function that returns (in_scope: bool, reasoning: str)sen-sg-02-PROP — Proposals system must exist for scope checkWhat was done:
scidex/senate/scope_evaluation.py (sen-sg-05-SCOP):evaluate_scope(proposal_dict) — LLM-based scope evaluation using llm.complete() with structured JSON response parsingevaluate_scope_from_proposal_id() convenience wrapperappeal_scope_rejection() in schema_governance.py for re-evaluation with appeal contextSCOPE_CRITERIA_IN_SCOPE and SCOPE_CRITERIA_OUT_OF_SCOPE as reusable prompt fragmentsmigrations/125_scope_evaluation.py (originally 114, renamed to avoid conflict with 114_skill_registry_canonical.py):senate_proposals: scope_check_passed (BOOL), scope_evaluation_reason (TEXT),scope_appealed (BOOL DEFAULT FALSE), scope_appeal_reason (TEXT), scope_appeal_evaluation (TEXT)scidex/senate/schema_governance.py:get_db() override and BASE/DB constants (dead code after PG migration)create_schema_proposal() now calls evaluate_scope() before INSERT:scope_check_passed and scope_evaluation_reason stored on the proposal rowget_proposal_status() now returns all scope fieldsappeal_scope_rejection(proposal_id, appeal_reason) — re-evaluates with appeal context,api_routes/senate.py:POST /api/senate/schema-proposal/{proposal_id}/appeal — trigger appeal with justificationPOST /api/senate/schema-proposal/scope-evaluate — dry-run scope eval (no DB write)Verified behavior:
Confirmed on current main (2e7f0af2d):
scidex/senate/scope_evaluation.py, scidex/senate/schema_governance.py modifications, api_routes/senate.py scope routes, migration 125PGShimConnection with _qmark_to_format translates ? to %s at execute time — safe to use SQLite-style placeholderssenate_proposals