[Senate] Domain scope enforcement — reject out-of-scope schema proposals done coding:8 safety:9

← Schema Governance
LLM evaluator assesses proposals for neuroscience/scientific-discovery relevance, auto-reject with appeal

Completion Notes

Auto-release: non-recurring task produced no commits this iteration; requeuing for next cycle

Git Commits (17)

Squash merge: orchestra/task/80ffb77b-quest-engine-generate-tasks-from-quests (117 commits) (#179)2026-04-26
Squash merge: orchestra/task/80ffb77b-quest-engine-generate-tasks-from-quests (116 commits) (#177)2026-04-26
Squash merge: orchestra/task/80ffb77b-quest-engine-generate-tasks-from-quests (80 commits) (#143)2026-04-26
Squash merge: orchestra/task/sen-sg-0-auto-migration-generation-from-approved (4 commits) (#90)2026-04-26
[Senate] Add schema proposal create/vote API routes; emit approval event [task:sen-sg-02-PROP]2026-04-25
[Atlas] Processing step lineage: add record_processing_step, reproducibility check, provenance graph enrichment, and /processing-history API (api.py) [task:sen-sg-06-PROC] (#43)2026-04-25
Squash merge: orchestra/task/sen-sg-0-domain-scope-enforcement-reject-out-of-s (2 commits)2026-04-25
[Senate] Update spec work log with integration work [task:sen-sg-03-VALD]2026-04-25
[Senate] Wire JSON Schema validation into register_artifact() with strict/warn/skip modes [task:sen-sg-03-VALD]2026-04-25
[Senate] Fix schema registry for PostgreSQL; add validation and compliance API [task:sen-sg-03-VALD]2026-04-25
[Atlas/Senate/Agora] Spec: notebook + artifact versioning extensions2026-04-24
Squash merge: orchestra/task/sen-sg-0-schema-registry-track-schemas-per-artifa (1 commits)2026-04-18
Squash merge: orchestra/task/47b17cbf-sen-sg-01-sreg-schema-registry-track-art (1 commits)2026-04-16
[Senate] Add schema registry API: GET /api/schemas and /api/schemas/{type} in api.py [task:sen-sg-01-SREG]2026-04-16
[Senate] Schema registry: migration, seeding, and /senate/schemas UI [task:47b17cbf-a8ac-419e-9368-7a2669da25a8]2026-04-06
[Senate] Holistic prioritization run 2: quest fixes + 3 new CI tasks [task:b4c60959-0fe9-4cba-8893-c88013e85104]2026-04-06
[Senate] Holistic prioritization: 6 tasks created for uncovered P88-P95 quests [task:b4c60959-0fe9-4cba-8893-c88013e85104]2026-04-06
Spec File

Goal

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.

Acceptance Criteria

evaluate_scope(proposal) function that returns (in_scope: bool, reasoning: str)
☑ Scope criteria encoded as prompt:
- In scope: experimental methodology, biological entities, disease mechanisms,
therapeutic targets, statistical results, data provenance, evidence quality,
scientific metadata, knowledge representation
- Out of scope: social media, marketing, unrelated domains, purely aesthetic metadata
☑ Scope evaluation runs before proposal enters voting
☑ Out-of-scope proposals auto-rejected with reasoning (can be appealed)
☑ Appeal process: proposer can add justification, triggers re-evaluation
☑ Scope criteria themselves governed (can be updated through Senate proposals)

Dependencies

  • sen-sg-02-PROP — Proposals system must exist for scope check

Dependents

  • None (enrichment task)

Work Log

2026-04-26 — sen-sg-05-SCOP implementation

What was done:

  • Created scidex/senate/scope_evaluation.py (sen-sg-05-SCOP):
  • - evaluate_scope(proposal_dict) — LLM-based scope evaluation using llm.complete() with structured JSON response parsing
    - Fast precheck with keyword matching before LLM call (avoids LLM cost for obvious cases)
    - IN_SCOPE_KEYWORDS (~60 terms): neuroscience, bioinformatics, statistical, etc.
    - OUT_OF_SCOPE_KEYWORDS (~20 terms): social media, marketing, crypto, sports, entertainment
    - evaluate_scope_from_proposal_id() convenience wrapper
    - appeal_scope_rejection() in schema_governance.py for re-evaluation with appeal context
    - SCOPE_CRITERIA_IN_SCOPE and SCOPE_CRITERIA_OUT_OF_SCOPE as reusable prompt fragments

  • Created migrations/125_scope_evaluation.py (originally 114, renamed to avoid conflict with 114_skill_registry_canonical.py):
  • - Adds to senate_proposals: scope_check_passed (BOOL), scope_evaluation_reason (TEXT),
    scope_appealed (BOOL DEFAULT FALSE), scope_appeal_reason (TEXT), scope_appeal_evaluation (TEXT)

  • Modified scidex/senate/schema_governance.py:
  • - Removed SQLite-only get_db() override and BASE/DB constants (dead code after PG migration)
    - create_schema_proposal() now calls evaluate_scope() before INSERT:
    - In-scope proposals → status='voting'
    - Out-of-scope → status='rejected', with scope fields populated
    - scope_check_passed and scope_evaluation_reason stored on the proposal row
    - get_proposal_status() now returns all scope fields
    - Added appeal_scope_rejection(proposal_id, appeal_reason) — re-evaluates with appeal context,
    reopens voting if appeal succeeds

  • Modified api_routes/senate.py:
  • - POST /api/senate/schema-proposal/{proposal_id}/appeal — trigger appeal with justification
    - POST /api/senate/schema-proposal/scope-evaluate — dry-run scope eval (no DB write)

    Verified behavior:

    • In-scope proposals (e.g., "Add statistical_power field to experiments") → in_scope=True
    • Out-of-scope proposals (e.g., "Add twitter_sentiment field to papers") → rejected via precheck ("Contains out-of-scope keyword: 'social media'")
    • Appeal correctly re-evaluated with proposer's justification; remained rejected when justification invoked marketing/social media terms

    2026-04-26 04:30 UTC — Re-verification after rebase

    Confirmed on current main (2e7f0af2d):

    • Scope evaluation code is NOT on main; only migration 125 rename commit is (2a52d9a16)
    • Worktree contains full implementation: scidex/senate/scope_evaluation.py, scidex/senate/schema_governance.py modifications, api_routes/senate.py scope routes, migration 125
    • PostgreSQL PGShimConnection with _qmark_to_format translates ? to %s at execute time — safe to use SQLite-style placeholders
    • Scope columns verified to exist in DB; scope evaluation columns already present in senate_proposals
    • End-to-end test confirmed: in-scope proposals enter voting, out-of-scope rejected at creation time, appeal endpoint works

    Payload JSON
    {
      "requirements": {
        "coding": 8,
        "safety": 9
      },
      "completion_shas": [
        "f71217a8f"
      ],
      "completion_shas_checked_at": ""
    }

    Sibling Tasks in Quest (Schema Governance) ↗

    Task Dependencies

    ↓ Referenced by (downstream)