Commit graph

12 commits

Author SHA1 Message Date
Shay
a447dce5d1 feat: ratify independent-gold invariant (INV-25) + SHA-pin deductive lane
INV-25 makes the GSM8K lesson structural: no capability claim is valid unless
its gold is computed by a procedure sharing no code with the system under test.
Three meaningfully-failing checks (proven able to fail): 25a oracle imports no
SUT module (AST); 25b every committed deductive gold is reproduced by the
independent oracle AND matched by the engine; 25c an unsound engine disagrees
on committed cases.

SHA-pin the deductive lane (deductive_logic_v1, dev+holdout+external 716/716,
wrong=0, refused=0) via a deterministic --report writer + run_as_module (the
lane dir's local generate.py shadows the package in script mode) + CLAIMS regen.

Fix drift the review surfaced: contract.md + pivot doc claimed an 8,000/7,340
fuzz and an 'external mirror' -> corrected to the real gated 3,000-case fuzz
(2,796 definite) and 'hand-authored, NOT a published-benchmark mirror'; pivot
doc GSM8K holdout 0->5 (all 5 are R1 reconstruction; composer scored 0).

Validated: smoke 78, deductive 23, proof 29, invariants 44, lane-sha+claims 9.
2026-06-04 15:56:28 -07:00
Shay
0770648257
feat(GSM8K): comprehension reading → first metric move 3/47/0 → 4/46/0 (#488)
* feat(adr-0189): comparative reading — anchor-verb widening + multi-word units

The candidate-graph comparative extractor (ADR-0131.G.2) read only has/have +
single-word units, so real-GSM8K comparatives ('Brooke does three times as many
jumping jacks as Sidney') didn't parse — a dark statement in 17 places blocking
15 of the 47 refused train_sample cases, despite the ADR-0123 solver already
supporting compare_additive/compare_multiplicative.

Widens the anchor-verb set (reusing legacy vetted lemmas + does/collected/
gained/studied…), EXCLUDING polarity-inverting verbs (lose/spend/give/sell/win)
to preserve wrong=0; admits 1-2 word units via the existing multi-word
_unit_grounds branch. Feeds the existing solver unchanged.

wrong=0 proven: G2_comparatives 29/29, G3 20/0, G4 32/32, train_sample 3/47/0
byte-identical; polarity-inverting verbs proven refused (failing-under-violation).
Chain composes correctly in isolation (146 -> 438). Flips 0 cases ALONE — every
comparative case needs a composing partner (aggregation / multi-word-noun
injection); this ships the component, not yet a flip.

- generate/math_candidate_parser.py: _comparison_anchor_verb widening + 1-2 word
  unit slots in the two multiplicative comparative regexes.
- tests/test_adr_0131_G2a_*: 5 tests incl. polarity-inversion wrong=0 guards.
- docs/decisions/ADR-0189: gap, change, wrong=0 evidence, honest scope.

* feat(adr-0189a): first metric move 3/47/0 -> 4/46/0 (case 0024, comprehension-composed)

Case 0024 now SOLVES (answer 438) by composing three general comprehension
capabilities feeding the unchanged ADR-0123 solver:
  1. day-of-week count enumeration: Sidney = 20+36+40+50 = 146
     (_day_enumeration_candidates; derived sum grounds via first count token,
      mirroring _embedded_quantifier; closed to the 7 day names)
  2. comparative reading (ADR-0189): Brooke = 3 x Sidney
  3. activity question 'How many <unit> did <Entity> <verb>?' (_Q_DID_RE)
Plus do/does/did added to the CandidateInitial anchor whitelist (production-
possession), admitted only via the closed day-enumeration shape.

wrong=0 PROVEN across every lane: all 8 capability axes wrong=0 (G2_comparatives
29/29, G3 20/0, G4 32/32, G5/S1/S3/S4 all pass), train_sample 4/46/0 wrong=0,
verify_lane_shas exit 0 (no pinned lane changed), generate_claims --check OK.
872 tests pass; new tests are failing-under-violation incl. wrong=0 guards
(non-day comma list not summed; polarity-inverting comparative verbs refused).

Re-baselined report.json + train_sample_coverage_report.json (latter also clears
pre-existing reason drift) + CLAIMS.md to the new 4/46/0 metric. Decode-not-guess:
0024 solved by READING its structure, not storing an answer. Remaining pre-existing
failures (G3 committed-report, telemetry) unrelated, fail on pristine main.

- generate/math_candidate_parser.py: day-enum extractor + _Q_DID_RE + does-anchor.
- tests/test_adr_0189a_day_enum_activity.py: 5 tests (incl. end-to-end 0024=438).
- docs/decisions/ADR-0189a + report.json/coverage/CLAIMS re-baseline.
2026-05-30 09:21:48 -07:00
Shay
ac77b88864
chore(ratify): accept four Phase C round-2 recognizers (round 2) (#309)
* chore(ratify): accept four Phase C round-2 recognizers (round 2)

Operator ratification of the four Phase B round-2 proposals per
ADR-0163:

- 8c7645b4 — discrete_count_statement
- 03627f6f — multiplicative_aggregation
- 00547671 — currency_amount
- 4d47a247 — temporal_aggregation (v2 widening)

All four passed Phase C's admissibility replay gate at propose-time:
replay_equivalent=True, wrong_count_delta=0.  Each acceptance also
appends the synthetic admissibility chain to teaching/cognition_chains.

Post-ratification empirical signal (verified by running the
train_sample lane):
- correct: 3 (unchanged)
- refused: 47 (unchanged)
- wrong: 0 (unchanged — invariant holds)

The case-level lift did not materialize because the architectural
bottleneck migrated from STATEMENT admission to QUESTION admission.
44 of 47 cases now refuse on a QUESTION (vs 7 pre-ratification).
The four new recognizers' matchers fire on 36 of 47 first-failed
sentences, but the cases then refuse on a different (later)
sentence — typically the question itself.

The unlock for this round is Phase D.3 (conditional-prefix question
recovery, PR #308) + a follow-up parser-grammar extension to handle
mass nouns (how much), modal verbs (will be able to), and pronoun
entity resolution.  Those touch grammar surface, not admission
wiring; separate ADR.

This PR commits the ratification audit trail.  The lift composes
when Phase D.3 lands and the grammar layer follows.

wrong=0 invariant: preserved by Phase D's skip-only construction.
Statement-level recognizer matches contribute zero math state to
the Cartesian product; no recognizer can introduce a wrong answer
under skip-only semantics.

Cross-references: ADR-0163, Phase A PR #297, Phase B round 1 PR
#298, Phase C PR #301, Phase D PR #302, ratify round-1 PR #304,
docs PR #305, Phase B round 2 PR #306, Phase C round-2 extension
PR #307, Phase D.3 PR #308.

* chore(ratify): re-pin public_demo lane SHA after round-2 ratification

The four round-2 ratifications appended synthetic admissibility
chains to teaching/cognition_chains/cognition_chains_v1.jsonl,
which is consumed by the public_demo lane.  The lane's deterministic
output SHA changed accordingly — drift confirmed by CI on origin
PR #309 (`✗ public_demo  e323adb35ea17987..  expected 888ddd0d12635d70..`).

Re-pin per the standard remediation:

  python scripts/verify_lane_shas.py --update
  python scripts/generate_claims.py

This is the expected corpus-mutation cycle following ratification.
No code change, no test change.  The new public_demo SHA reflects
the engine's new admissibility surface; the lane runner's output
is byte-stable under the new corpus.

Cross-references: ratify round-2 PR #309 (this branch), Phase D
PR #302, Phase C PR #301.
2026-05-26 16:03:01 -07:00
Shay
0ad97e5ef7
perf(tests): extract math_teaching_corpus lane from pytest into CI lane SHAs (-9m suite time) (#261)
* perf(tests): extract math_teaching_corpus lane from pytest into CI lane SHAs

The two slowest tests in the pytest suite were:

  388s test_adr_0131_2_teaching_corpus_lane::test_report_is_byte_equal_across_runs
  161s test_adr_0131_2_teaching_corpus_lane::test_lane_passes_exit_criterion

Both invoked build_report() from evals.math_teaching_corpus.v1.runner —
the canonical math-teaching-corpus lane runner — once for the exit
criterion and again for byte-equality. Together: 549s = 9m 9s, 30% of
the full pytest suite, recomputed on every developer run.

This is the exact 'lane runner invoked from pytest' anti-pattern that
the existing scripts/verify_lane_shas.py CI job is designed to absorb.
The other 7 lanes (reviewer_registry, miner_loop_closure, etc.) all
run in CI via SHA pinning rather than in pytest.

Changes:

  scripts/verify_lane_shas.py — add math_teaching_corpus_v1 spec +
    PINNED_SHAS entry (eaf160d145da29f9..., computed locally from
    a clean run of the lane in this commit's tree).
  scripts/generate_claims.py — add _LANE_ADR entry (ADR-0131) +
    claim text. Failing fast on missing lanes is by design.
  CLAIMS.md — regenerated; one new row.
  tests/test_adr_0131_2_teaching_corpus_lane.py — delete TestLaneGate
    class (2 tests, 549s). Retain TestDatasetIntegrity (5 tests),
    TestBoundedDomain (2), TestHonestEvidence (1) — these are
    fast (0.26s total) and pin contracts the lane runner does not
    cover (dataset shape, lemma boundedness, evidence reachability).
    Replace deletion with an explanatory comment block.

The deleted contracts are still enforced — just in CI instead of
pytest:

  exit criterion → runner exit code (returns 1 on failure)
  byte-equality  → PINNED_SHAS verification (SHA-256 of report.json)

Verified locally:

  scripts/verify_lane_shas.py — 8/8 lanes match pinned SHAs
  pytest tests/test_adr_0131_2_teaching_corpus_lane.py — 8/8 pass in 0.26s

Expected full-suite delta: -549s (from ~30m to ~21m). Further speedup
will come from the upcoming full-pytest CI gate with pytest-xdist -n4.

* ci: bump lane-shas timeout 12m → 20m for new math_teaching_corpus lane

The math_teaching_corpus_v1 lane added in this PR runs in ~5-6 min,
pushing the total lane-shas job over the previous 12-min timeout.
First CI run cancelled at 12m17s. Bumping to 20m gives ~8m headroom.

* fix(ci): bump lane subprocess timeout 300s→900s + add math_teaching_corpus to test_lane_sha_verifier EXPECTED_LANES

Two issues surfaced by CI run on the prior commit:

1. The math_teaching_corpus lane takes ~142s wall-clock locally (3.79
   cores × ~538s CPU). On CI's single/dual-core runner that translates
   to ~5-9 min, exceeding the 300s subprocess timeout in
   scripts/verify_lane_shas.py. Bumping to 900s gives ~60% headroom.

2. tests/test_lane_sha_verifier.py::TestExpectedLaneCoverage::test_all_expected_lanes_covered
   hardcodes the expected lane set. Adding math_teaching_corpus_v1 to
   LANE_SPECS triggered the 'extra lanes' assertion. Adding it to
   EXPECTED_LANES (the file's own contract: 'if intentional, add here').
2026-05-25 05:42:12 -07:00
Shay
11c91581e8
fix(W-015): replace _slerp_toward with rotor-geodesic anchor pull (#255)
Closes W-015 wiring debt. Per Sonnet's investigation (PR #252,
verdict (c)): _slerp_toward interpolates on S^31 but the versor
manifold (Spin sub-group in Cl(4,1)) is a proper subset. Slerp's
geodesic doesn't stay on the manifold, producing systematic
off-manifold state that the post-hoc unitize_versor was repairing.

Fix replaces _slerp_toward with the proper rotor-geodesic path:
    R      = word_transition_rotor(field_state.F, anchor_field)
    R_step = rotor_power(R, _ANCHOR_PULL_ALPHA)
    pulled_F = versor_apply(R_step, field_state.F)

rotor_power stays on the manifold by construction (same principle
as generate/stream.py:220). versor_apply closes via algebra/
versor.py — an already-sanctioned site. The unsanctioned
unitize_versor call in _anchor_pull and the entire _slerp_toward
function are removed.

CLAUDE.md normalization-site discipline is now restored:
session/context.py:_anchor_pull no longer performs normalization.

Changes:
- session/context.py: import rotor_power + word_transition_rotor,
  remove _slerp_toward (34 lines), rewrite _anchor_pull to use
  rotor-geodesic (15 lines net change).
- tests/test_session_coherence.py: new test pins the manifold
  invariant — after anchor pull, versor_condition stays < 1e-6
  without any unitize call (32 lines).

Intentional lane re-pins (audit-trail per #229 discipline):
- demo_composition: 403be13b → 3a3d09f3 (anchor pull now produces
  correct on-manifold fields; demo output shifts as expected).
- public_demo: acd51d0c → 888ddd0d (same cause).

CLAIMS.md regenerated to reflect new pins (per #239 lesson).

Verification:
- tests/test_session_coherence.py: 3 passed
- core test --suite smoke: 67 passed
- scripts/verify_lane_shas.py: 7/7 match (post-re-pin)
- Manifold invariant test pinned: anchor pull preserves
  versor_condition < 1e-6 by construction (no repair).

Investigation source: PR #252 (Sonnet). 4,138-sample bimodal
distribution confirmed _slerp_toward as the sole drift source.
2026-05-24 20:05:25 -07:00
Shay
ffe439c889
chore(ci): re-pin drifted lane SHAs + refresh canonical reports (#229)
Three lane SHA pins drifted because intentional surface/serialization
changes shipped without re-running scripts/verify_lane_shas.py --update.

Bisect attributing the drift:
- demo_composition + public_demo broke at 5cad0a4 (#118 ADR-0110
  mathematics_logic → expert_demo) — the demos enumerate the expert set.
- demo_composition drifted a second time at ab4c7cb (#220 Phase 3
  state tagging spine) — additional epistemic fields shifted the surface.
- domain_contract_validation broke at a45eab1 (#219 Phase 2 epistemic
  bug repairs) — normative/epistemic field shape changed.

The in-tree canonical report for fabrication_control_summary was also
stale vs. its (correct) pin; refreshed here for byte-alignment.

After this commit: 7/7 lanes match pinned SHAs; verify_lane_shas.py
runs green locally and in CI.

Followup (separate PR): hook/template guard so future PRs that touch
core/cognition/result.py, chat/runtime.py, or capability registries
re-run --update before merge.
2026-05-24 14:25:11 -07:00
Shay
9bc6110411 chore: regenerate CLAIMS.md (rebased onto ADR-0124 state) 2026-05-22 17:06:11 -07:00
Shay
696f62abdd feat: ADR-0113 rename expert-demoaudit-passed; reserve expert namespace (ADR-0114 GSM8K roadmap)
The word "expert" in the previous status name implied raw-capability parity
with frontier LLMs on the same benchmark — which the gate does NOT verify.
What the gate actually verifies is CORE *claim-shape compliance*:

  * signed digest (replay-reproducible from on-disk lane results)
  * replay determinism (same inputs → byte-equal trace_hash)
  * typed refusal (fabrication refused, not paraphrased)
  * exact recall (no ANN, no cosine, no attention bottleneck)
  * grounding-source provenance

These are claim shapes a transformer LLM cannot structurally produce
regardless of raw accuracy. A frontier LLM might score higher on the
same benchmark but cannot pass this contract.

Rename scope (semantics only, per ADR-0113):

  status string         "expert-demo"        → "audit-passed"
  predicate key         predicates.expert_demo → predicates.audit_passed
  reason key            expert_demo_reason   → audit_passed_reason
  YAML key              expert_demo_claims   → audit_passed_claims
  CLI command           core demo expert     → core demo audit-passed
  output dir            evals/expert_demos/  → evals/audit_passed/
  artifact filenames    expert_demo.{json,html} → audit_passed.{json,html}
  HTML title            CORE Expert-Demo: X  → CORE Audit-Passed: X

Internal Python identifiers (module/file/function/class names like
`expert_demo.py`, `evaluate_expert_demo`, `ExpertDemoClaim`,
`expert_demo_claim_for`) are deliberately kept to minimize churn. ADR
file titles (ADR-0106..0112) preserved as historical record.

`expert` namespace reserved for ADR-0114+: an actual capability tier
above `audit-passed` backed by a public benchmark with a stated
threshold. ADR-0114 proposes the first such target — GSM8K-math —
laying out a falsifiable 7-phase arc (parser → solver → verifier →
stepped-realizer → eval lane → first `expert` ledger tier promotion).

Tests: 184 directly-affected tests green (140 capability/expert-demo
suite + 34 demo/audit-tour + 10 correction-cue). Smoke suite 67/67.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 15:36:10 -07:00
Shay
0c448a475c chore: regenerate CLAIMS.md for physics expert-demo
Picked up by the lane-shas workflow's CLAIMS.md freshness check.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 14:42:16 -07:00
Shay
5cad0a4b72
feat(capability): ADR-0110 promote mathematics_logic to expert_demo (#118)
First worked expert-demo promotion under the ADR-0106 + ADR-0109
contract. Math is now the first domain at expert_demo=true.

Signed claim (docs/reviewers.yaml):
  domain_id: mathematics_logic
  evidence_lanes: [elementary_mathematics_ood, inference_closure,
                   fabrication_control]
  evidence_revision: adr-0110:reviewed:2026-05-22
  signed_by: shay-j
  claim_digest: 94d74781e103854230c1a71590e4df2287f5d2e87832f1c29b8ec4618853c04b

Evidence (all three lanes, public + holdout):
  elementary_mathematics_ood: accuracy=1.0 (117/117 public, 39/39 holdout)
  inference_closure: all_pass_rate=1.0, replay_determinism=1.0,
                     overall_pass=True (20 public, 12 holdout)
  fabrication_control: by-class refusals 3/3/3, fabricated=0
                       (9 public, 9 holdout)

Infrastructure bridges (not contract changes):
- cases_plaintext.jsonl dev-mode fallback files for
  elementary_mathematics_ood + inference_closure (ADR-0105 pattern)
- 9 new holdout cases for fabrication_control across all three
  refusal classes (phantom_endpoint / cross_pack_non_bridge /
  sibling_collapse)
- core/capability/reporting.py: _fetch_lane_split folds top-level
  by_class into metrics so refusal_shape sees a canonical layout

Tests:
- tests/test_adr_0110_math_expert_demo.py: 4 invariant tests
  (math_expert_demo_holds, signed_claim_present, replay_digest_
  byte_equality, other_domains_unaffected)
- tests/test_adr_0107_deferral.py retired (deferral resolved)
- tests/test_expert_demo_contract.py: production-ledger test
  rewritten as 'every promoted domain has signed claim' (load-
  bearing invariant preserved)
- tests/test_capability_reports.py: math row asserted at
  expert-demo (was reasoning-capable)

Ledger state:
  systems_software: reasoning-capable
  mathematics_logic: EXPERT-DEMO   <- new
  physics: reasoning-capable
  hebrew_greek_textual_reasoning: reasoning-capable
  philosophy_theology: reasoning-capable

README updated. ADR-0107 referenced as resolved by this ADR.
CLAIMS.md regenerated. ADR-0106 / ADR-0109 contract unchanged.
2026-05-22 12:59:23 -07:00
Shay
f7680e96ea
feat(teaching): ADR-0104 — curriculum-sourced teaching proposals (#107)
* feat(teaching): add curriculum-sourced proposal builder

* test(teaching): cover curriculum proposal construction

* test(evals): add curriculum loop closure contract

* test(evals): add curriculum loop closure runner

* test(evals): add canonical curriculum loop closure report

* ci(lanes): pin curriculum loop closure lane

* docs(adr): add ADR-0104 curriculum sourced proposals

* docs(adr): register ADR-0104 and seven pinned lanes

* docs(teaching): mark curriculum source activation

* fix(ci): pin curriculum_loop_closure SHA to runner output

* fix(ci): register curriculum_loop_closure in CLAIMS.md generator
2026-05-22 10:05:14 -07:00
Shay
60da4f0cd0 feat(claims): auto-generate CLAIMS.md from ledger + pinned lane SHAs
CLAIMS.md is now mechanically derived from two ground-truth sources:
- core.capability.ledger_report (Tier 1: ratified domains)
- scripts/verify_lane_shas.PINNED_SHAS (Tier 2: pinned lane reports)

The generator is deterministic and gated by
tests/test_claims_md_is_current.py + the lane-shas CI workflow's new
'verify CLAIMS.md is current' step. Drift between in-tree state and
the published claims fails CI before merge.

Tier 1 (5 ratified domains) and Tier 2 (6 pinned lanes) cover every
ADR-0092..0102 invariant currently CI-pinned.
2026-05-21 21:02:36 -07:00