[Atlas] Add gap prioritization scoring based on research impact potential done

← Gap Factory
## REOPENED TASK — CRITICAL CONTEXT This task was previously marked 'done' but the audit could not verify the work actually landed on main. The original work may have been: - Lost to an orphan branch / failed push - Only a spec-file edit (no code changes) - Already addressed by other agents in the meantime - Made obsolete by subsequent work **Before doing anything else:** 1. **Re-evaluate the task in light of CURRENT main state.** Read the spec and the relevant files on origin/main NOW. The original task may have been written against a state of the code that no longer exists. 2. **Verify the task still advances SciDEX's aims.** If the system has evolved past the need for this work (different architecture, different priorities), close the task with reason "obsolete: " instead of doing it. 3. **Check if it's already done.** Run `git log --grep=''` and read the related commits. If real work landed, complete the task with `--no-sha-check --summary 'Already done in '`. 4. **Make sure your changes don't regress recent functionality.** Many agents have been working on this codebase. Before committing, run `git log --since='24 hours ago' -- ` to see what changed in your area, and verify you don't undo any of it. 5. **Stay scoped.** Only do what this specific task asks for. Do not refactor, do not "fix" unrelated issues, do not add features that weren't requested. Scope creep at this point is regression risk. If you cannot do this task safely (because it would regress, conflict with current direction, or the requirements no longer apply), escalate via `orchestra escalate` with a clear explanation instead of committing.

Completion Notes

Verification commit 012293768 pushed ahead of origin/main. Gap prioritization scoring (POST /api/gaps/{gap_id}/score + scidex/agora/gap_scoring.py) confirmed present on origin/main at HEAD 8f0852579 via git show commands. No duplicate work needed.

Git Commits (2)

[Atlas] Update gap scoring spec work log — commit message fix (api.py) [task:6681bce36b39]2026-04-16
[Atlas] Add POST /api/gaps/{gap_id}/score (api.py) — gap research impact scoring endpoint2026-04-16
Spec File

[Atlas] Add gap prioritization scoring based on research impact potential

Quest: Gap Factory Priority: P2 Status: open

Goal

Add gap prioritization scoring based on research impact potential

Context

This task is part of the Gap Factory quest (Atlas layer). It contributes to the broader goal of building out SciDEX's atlas capabilities.

Acceptance Criteria

☐ Implementation complete and tested
☐ All affected pages load (200 status)
☐ Work visible on the website frontend
☐ No broken links introduced
☐ Code follows existing patterns

Approach

  • Read relevant source files to understand current state
  • Plan implementation based on existing architecture
  • Implement changes
  • Test affected pages with curl
  • Commit with descriptive message and push
  • Work Log

    2026-04-16 — Slot 0 (minimax:66)

    • Analysis: Task was previously marked done but audit could not verify work on main. Re-evaluating current main state.
    • Discovery: gap_scoring.py (scidex/agora/gap_scoring.py) already exists and implements 5-dimension research impact scoring via LLM (importance, tractability, hypothesis_impact, novelty, data_readiness) using compute_gap_score() from scidex/exchange/exchange.py. The gap_quality.py separately handles gap quality dimensions (specificity, evidence_coverage, hypothesis_density, debate_depth, actionability).
    • gap_scanner.py (scripts/) calls gap_scoring.score_knowledge_gap() to filter auto-detected gaps by importance_score >= 0.5 before creating.
    • Gap API: The /api/gaps GET endpoint sorts by priority_score and already returns gaps with composite/priority scores. No POST endpoint existed to trigger re-scoring on demand.
    • Implementation: Added POST /api/gaps/{gap_id}/score endpoint (api.py lines ~8386) that:
    1. Looks up the gap by ID
    2. Calls gap_scoring.score_knowledge_gap() for LLM evaluation
    3. Persists all scores (importance, tractability, hypothesis_impact, novelty, data_readiness, composite_score, priority_score) to the gap record via update_knowledge_gap()
    4. Returns the full score dict
    • Note: Live API server (port 8000) couldn't be restarted in this environment (venv path issues), but api.py loads correctly from worktree and gap_scoring module works standalone. API restart is handled by Orchestra sync/push workflow.
    • Status: Done — endpoint added, syntax verified, imports resolve correctly

    2026-04-16 — Slot 0 (minimax:66) — Push Fix

    • Issue: Previous push was blocked by pre-push hook — commit touched api.py but message didn't mention it
    • Fix: Rebased onto latest origin/main (ceb8d63c0), amended commit message to include "(api.py)"
    • Commit: 7fbc8d979 [Atlas] Add POST /api/gaps/{gap_id}/score (api.py) — gap research impact scoring endpoint
    • Push: Force pushed to orchestra/task/6681bce3-add-gap-prioritization-scoring-based-on — now ahead of origin/main by 1 commit
    • Status: Awaiting supervisor merge to main

    Payload JSON
    {
      "_reset_note": "This task was reset after a database incident on 2026-04-17.\n\n**Context:** SciDEX migrated from SQLite to PostgreSQL after recurring DB\ncorruption. Some work done during Apr 16-17 may have been lost.\n\n**Before starting work:**\n1. Check if the task's goal is ALREADY satisfied (run the relevant checks)\n2. Check `git log --all --grep=task:YOUR_TASK_ID` for prior commits\n3. If complete, verify and mark done. If partial, continue. If not done, proceed.\n\n**DB change:** SciDEX now uses PostgreSQL. `get_db()` auto-detects via\nSCIDEX_DB_BACKEND=postgres env var.",
      "_reset_at": "2026-04-18T06:29:22.046013+00:00",
      "_reset_from_status": "done"
    }

    Sibling Tasks in Quest (Gap Factory) ↗