03 / Scientific retrieval

Keep source navigation tied to exact code.

Index immutable Fortran source, recover continued declarations, and return source-checked excerpts with honest retrieval limits.

LegacyLens / Quasar · Local release

declarations recovered
379 / 379
source-navigation controls
14 / 14
tests including real PostgreSQL
207

The problem

The advertised ingest/query/evaluation commands were TODOs. Citation validation accepted broad spans and ambiguous basenames, while the parser missed continued routine declarations.

My contribution

I connected ingestion, real local embeddings, pgvector retrieval, source validation, CLI/API workflows and versioned evaluation. A parser repair restores physical declaration spans without changing source text.

How it works

  1. Pinned Git snapshot
  2. Source-aligned chunks + BGE vectors
  3. Symbol/file navigation + vector search
  4. Exact citations or abstention

Decisions that shaped the release

Measured results

Both strategies were measured on the same 28-file, 4,597-vector index. The ten answerable development questions have representative, nonexhaustive evidence labels.

LegacyLens / Quasar: release evidence
Development measurement Vector only Symbol aware
Selected-evidence MRR@10 0.00 0.20
Selected-evidence recall@10 0.00 0.15
Absent-identifier abstention 0 / 2 2 / 2
Literal citation grounding 100% returned citations 100% returned citations

A failure worth inspecting

A three-line declaration needs three physical source lines.

The query returns the actual declaration and leading documentation. Out-of-range spans, conflicting text and ambiguous basenames are rejected. An independent inventory recovered 100 declarations missed by the original parser.

{
  "file": "src/hazFXnga13l.f",
  "declaration_lines": [
    9744,
    9746
  ],
  "symbol": "CY201305_NGA",
  "origin": "symbol_definition",
  "old_parser": "missed the continued declaration",
  "repaired_parser": "preserves all three physical lines",
  "source_excerpt": "        subroutine CY201305_NGA(ip,iprd, M, R_Rup, R_JB, R_x, V_S30,\n     1            F_Measured, F_Inferred, deltaZ1, DELTA, Z_TOR,\n     1            F_RV, F_NM, cDPP,gndout, tau, sigma_NL0, sigmaf)",
  "public_source": "https://github.com/usgs/nshmp-haz-fortran/blob/9f78db0c3d9cd66f90d7aeda6b1082e6dad71502/src/hazFXnga13l.f#L9744-L9746",
  "citation_controls": [
    {
      "reference": "src/hazFXnga13l.f:9744-9746",
      "decision": "accepted",
      "reason": "Exact visible source span"
    },
    {
      "reference": "src/hazFXnga13l.f:9739-9746",
      "decision": "rejected",
      "reason": "Reference is outside the visible retrieved source"
    },
    {
      "reference": "hazFXnga13l.f:9744-9746",
      "decision": "rejected",
      "reason": "Reference is outside the visible retrieved source"
    }
  ]
}

Inspect the pinned public source lines

Limits and next questions

Inspect the evidence

Download sanitized evidence (JSON) · SHA256

Private implementation · sanitized evidence available

Software controls, development-set measurements and model quality retain separate denominators. Local release artifacts are prepared for review; no public deployment is implied.