core/generate
Shay 3e9c9ce10d
chore: comb-pass closeout — item 17 + Tier 5 minor cleanups (#94)
Comb pass 2026-05-21.

Item 17 — redundant ``^`` anchors in ``re.match()`` patterns:

  ``re.match`` anchors at the start of the string automatically, so
  the leading ``^`` was documentation-only noise on every pattern
  consumed via ``.match()``.  Audited each pattern's call site:

    * ``_RULES`` (line 144) — used via ``pattern.match(text)`` → strip
    * ``_ANAPHORIC_FOLLOWUPS`` — used via ``pattern.match(text)`` → strip
    * Module-level ``_COMPARE_RE`` / ``_TRANSITIVE_QUERY_RE`` /
      ``_FRAME_TRANSFER_RE`` / ``_BELONG_QUERY_RE`` /
      ``_DECLARATIVE_RELATION_RE`` / ``_HOW_DOES_X_RE`` — all
      ``.match()`` → strip
    * Inline ``re.match`` in ``_strip_confirmation_tail`` → strip
    * ``_RESPONSE_MODE_RULES`` — used via ``pattern.search(text)`` →
      KEEP ``^`` (``re.search`` does not anchor)

  Trailing ``$`` anchors retained throughout because neither
  ``re.match`` nor ``re.search`` anchors at the end.

  A comment block documents the convention so future contributors
  understand the ``^`` retain-vs-strip rule.

Tier 5 minor (``chat/runtime.py``):

  * Hoisted ``{"is", "are", "was", "were"}`` to module-level
    ``_BE_FORMS`` constant.  Pre-fix ``_prefer_prompt_anchor``
    constructed this set on every English turn.
  * Replaced the content-token list comprehension + ``[-1]`` slice
    with a reverse-iteration short-circuit.  Pre-fix the function
    materialised the full filtered list just to pick the last
    element.
  * Cached ``token.casefold()`` once per token via a local in the
    loop body.  Pre-fix the comprehension called ``.casefold()``
    twice per token (against ``_QUESTION_WORDS`` and the inline
    aux-verb set).

Validation:

  * ``core eval cognition`` byte-identical across all three splits:
    public 100/100/91.7/100, dev 100/100/78.6/100, holdout
    100/100/83.3/100.
  * ``core test --suite cognition`` 120/0/1, ``smoke`` 67/0.
  * ``pytest -k intent`` 236/0 (all intent classification tests
    pass with the ``^`` removals — the patterns behave identically
    under ``re.match`` regardless of the leading anchor).
2026-05-20 21:00:22 -07:00
..
__init__.py chore(generate): delete unreachable agenerate (#90) 2026-05-20 19:59:28 -07:00
admissibility.py feat(adr-0026): Phase 3 — ranked admissibility with margin 2026-05-17 15:03:03 -07:00
articulation.py Graceful fallback in realize() when slot versors are missing 2026-05-13 21:41:52 -07:00
articulation_legality.py feat(realizer): C1.5 — articulation legality at the realizer boundary 2026-05-20 11:11:28 -07:00
attention.py Add ADR-0008 salience attention 2026-05-13 22:40:36 -07:00
bridge_trace.py Phase 1 — bridge trace instrumentation (observation-only) 2026-05-18 18:04:57 -07:00
dialogue.py Fix test suite errors across core physics and generation 2026-05-14 13:02:32 -07:00
discourse_planner.py feat(intent): normalize confirmation-tag propositions (#45) 2026-05-19 22:55:28 -07:00
exhaustion.py feat(adr-0025): Phase 4 — rotor / frame admissibility at the seam 2026-05-17 15:16:32 -07:00
graph_constraint.py fix(adr-0046): make forward-graph-constraint branch mergeable 2026-05-18 05:57:46 -07:00
graph_planner.py perf(graph): PropositionGraph.topo_order — Kahn's O(N+E) instead of O(N×E) (#92) 2026-05-20 20:37:21 -07:00
grounding_accessors.py feat(grounding): structured GroundedFact accessors for discourse planner 2026-05-19 11:19:59 -07:00
intent.py chore: comb-pass closeout — item 17 + Tier 5 minor cleanups (#94) 2026-05-20 21:00:22 -07:00
intent_bridge.py Phase 2 — proposition-slot grounding for articulate_with_intent 2026-05-18 18:18:31 -07:00
intent_ratifier.py chore(ratifier): calibrate default ratification threshold 0.0 → 0.5 (#86) 2026-05-20 19:59:25 -07:00
morphology.py fix(gaps): close G1+G2+G3 + identity vocab + pipeline safety-stub honour 2026-05-16 21:21:06 -07:00
operators.py feat(compositionality): compose_relations operator lifts lane 68.8% → 100% 2026-05-16 22:44:06 -07:00
proposition.py feat(adr-0022): Forward Semantic Control — Accepted 2026-05-17 12:10:20 -07:00
realizer.py perf(cognition): hot-path comb pass — 5 mechanical-sympathy fixes (#91) 2026-05-20 20:31:56 -07:00
realizer_guard.py feat(coherence): ADR-0075 — realizer slot-type guard (C1) 2026-05-19 22:35:09 -07:00
render.py feat(generate): add render.py — default TextRenderer and Renderer protocol (ADR-0011) 2026-05-13 10:51:52 -07:00
result.py feat(adr-0023): Forward Semantic Control proof evidence — Accepted 2026-05-17 12:55:19 -07:00
rotor_admissibility.py feat(adr-0025): Phase 4 — rotor / frame admissibility at the seam 2026-05-17 15:16:32 -07:00
salience.py Implement core physics and pack validation 2026-05-14 12:35:19 -07:00
semantic_templates.py feat: vault recall index, Rust versor parity, cognitive pack expansion 2026-05-15 15:34:39 -07:00
stream.py chore(generate): make stop-tokens caller-overridable via RuntimeConfig (#87) 2026-05-20 19:59:33 -07:00
surface.py feat(surface): ADR-0031 — score-decomposition surface (per-axis hedges) 2026-05-17 20:16:22 -07:00
templates.py feat(realizer): C1.5 — articulation legality at the realizer boundary 2026-05-20 11:11:28 -07:00