core/docs/handoff
Shay 5d1f1001f4 feat(adr-0174-phase3a): lookback re-evaluation operator + pronoun resolution substrate
ADR-0174 Phase 3a — substrate for held-hypothesis lookback.
Score unchanged at 3/47/0 (this PR is correctly-engineered
infrastructure; eval impact gated on ADR-0163.x recognizer expansion
documented in the follow-up brief).

Adds generate/comprehension/lookback.py:
- VALID_REFINEMENT_KINDS, VALID_UNRESOLVED_SLOTS — closed sets
  contracted with reader_trace consumer
- PronounResolution refinement dataclass (pronoun + resolved_to +
  evidence_source, all validated)
- Refinement Union (Phase 3b will widen with CompoundClauseExpansion)
- ReevaluateResult dataclass with admit/eliminate consistency
- reevaluate(hypothesis, refinement) operator — applies refinement,
  re-runs check_constraints, returns refined Hypothesis or None.
- _rebuild_candidate_with_resolved_actor — rebuilds
  CandidateOperation / CandidateInitial replacing the semantic actor
  field (op.actor / initial.entity) while preserving matched_actor_token
  / matched_entity_token as the pronoun (so grounding still passes
  against the held statement's source span).

Modifies generate/recognizer_match.py:
- _try_extract_discrete_count_anchor: pronoun-subject statements now
  emit anchors with subject_role=<pronoun> + requires_pronoun_resolution
  marker, rather than refusing at the _REFUSED_SUBJECT_TOKENS check.
  The other narrowness layers (clause split, verb whitelist) still
  refuse; only the pronoun layer changes.

Modifies generate/math_candidate_graph.py:
- After inject_from_match, when any parsed_anchor carries
  requires_pronoun_resolution, the candidates are held as Hypothesis
  objects with unresolved=('actor_pronoun',). The lookback path then
  resolves via the existing _discourse_prior_subjects map and runs
  PronounResolution refinements through reevaluate.  Resolved
  hypotheses flow into per_sentence_choices as if the regex parser
  had produced them; unresolved hypotheses drop cleanly (refusal-
  preferring).  Emits 'lookback' JSON trace events with
  outcome ∈ {admitted, eliminated, no_antecedent}.

Tests:
- tests/test_adr_0174_phase3_lookback.py — 17 acceptance tests
  covering operator semantics on Operation/Initial, dataclass
  invariants, closed-set constants, end-to-end wiring on synthetic
  problems, and wrong=0 preservation on train_sample.

Phase 3.1 follow-up brief:
- docs/handoff/PHASE-3.1-FOLLOWUP-RECOGNIZER-EXPANSION.md documents
  the empirical finding that the train_sample bottleneck is
  verb-coverage (recognizer scope, ADR-0163.x) not lookback
  (ADR-0174 scope). 11 verbs identified for HITL contemplation pass.
  Recommends sequencing: Phase 3a now (substrate), ADR-0163.x verb
  expansion next, Phase 3b after coverage matures.

Acceptance verified:
- 17/17 Phase 3a tests pass
- 95/95 existing tests pass (Phase 1 + Phase 2 + brief_11 + reader_phase2)
- Smoke 67/67, packs 141/141, lanes 8/8
- wrong=0 preserved, score unchanged 3/47/0 (intentional per brief)

Stacks on Phase 2 (PR #420). Rebases onto main after #416 + #420 land.
2026-05-28 10:49:20 -07:00
..
phase-3b-4-skeleton docs(handoff): phase 3b+4 skeleton pack — tests + en_core_names_v1 starter 2026-05-28 10:01:05 -07:00
ADR-0084-pack-content-brief.md
ADR-0085-content-style-pass-brief.md
ADR-0085-content-style-pass-v2-brief.md
ADR-0167-FOLLOWUPS.md chore: remove stub injector + superseded docs (cleanup-as-you-find) (#373) 2026-05-27 11:08:14 -07:00
ADR-0167-PARALLEL-WORK-PLAN.md
ADR-0167-W2C-cross-domain-audit.md
ADR-0172-TIER1-BRIEF-PACK.md docs(ADR-0172): fix evidence-module path in Tier 1 brief pack (#381) 2026-05-27 12:18:19 -07:00
ADR-0174-PHASE-3B-4-COMBINED-SCOPE.md docs(handoff): ADR-0174 Phase 3b + Phase 4 combined scope 2026-05-28 09:54:45 -07:00
BRIEF-11-phase-2-reader-closure-and-capability-snapshot.md
CLEANUP-C2-run-lane-migration.md chore(audit): substrate cleanup — dead spike, gitignore, deprecation, reader diagnosis 2026-05-28 07:00:33 -07:00
CLEANUP-C4-compositions-compile.md chore(audit): substrate cleanup — dead spike, gitignore, deprecation, reader diagnosis 2026-05-28 07:00:33 -07:00
CODEX-domain-pack-closure-cleanup-brief.md
CODEX-greek-hebrew-content-phase-ii-brief.md
COMPOSITION-FRAME-CONSUMPTION-WIRING-BRIEF.md docs(consumption-wiring): brief for closing Frame + Composition loop halves (#396) 2026-05-27 16:14:50 -07:00
COMPOSITIONCLAIM-BRIEF-PACK.md docs(compositionclaim): brief pack — ADR-0169 doctrine + handler + heuristic tightening (#390) 2026-05-27 14:46:24 -07:00
COMPREHENSION-READER-AUDIT.md docs(brief-C): comprehension reader audit — zero eval delta diagnosis + next steps 2026-05-27 20:45:31 -07:00
CONSUMPTION-WIRING-DISPATCH-PACK.md docs(consumption-wiring): operator dispatch pack (CW-1 + CW-2) (#397) 2026-05-27 16:16:41 -07:00
DCS-S1-FINDING.md docs(ADR-0170): injector contract widening + DCS-S1 schema-gap finding (#372) 2026-05-27 10:51:46 -07:00
discrete_count_statement-injector-spec.md docs(handoff): reconcile discrete_count_statement injector spec (#366) 2026-05-27 09:51:30 -07:00
MATCHER-EXTENSION-DISPATCH-PACK.md docs(matcher-extension): dispatch pack (ME-1) (#399) 2026-05-27 16:17:30 -07:00
ME1-ME5-MILESTONE.md feat(matcher-extension/ME-5): integration smoke + ME-1..ME-5 milestone 2026-05-27 17:35:10 -07:00
PHASE-3.1-FOLLOWUP-RECOGNIZER-EXPANSION.md feat(adr-0174-phase3a): lookback re-evaluation operator + pronoun resolution substrate 2026-05-28 10:49:20 -07:00
POST-RAT1-PARALLEL-BRIEFS.md docs(post-rat1): four parallel dispatch briefs (B/C/D/E) 2026-05-27 20:24:39 -07:00
TIER2-AND-FRAMECLAIM-BRIEF-PACK.md docs(tier1.5+tier2): FrameClaim handler + Tier 2 W5 schema brief pack (#387) 2026-05-27 14:05:53 -07:00
VERB-EXPANSION-DISPATCH-PACK.md docs(handoff): require multi-actor pronoun safety test in VE-A/B acceptance 2026-05-28 09:19:46 -07:00
WAVE-NEXT-REVISED.md chore: remove stub injector + superseded docs (cleanup-as-you-find) (#373) 2026-05-27 11:08:14 -07:00
WORKBENCH-UI-WAVE-BRIEF-PACK.md docs(workbench-ui): wave brief pack (W1..W4) (#395) 2026-05-27 15:35:05 -07:00
WORKBENCH-UI-WAVE-SCOPING.md docs(workbench-ui): scoping brief for UI wave (W0..W4) (#392) 2026-05-27 15:09:58 -07:00