Skip to content

feat(proposal-engine): grounding contract — fabrication as a type error - #549

Merged
LifeAtlas merged 2 commits into
masterfrom
feat/proposal-engine-grounding
Jul 25, 2026
Merged

feat(proposal-engine): grounding contract — fabrication as a type error#549
LifeAtlas merged 2 commits into
masterfrom
feat/proposal-engine-grounding

Conversation

@LifeAtlas

Copy link
Copy Markdown
Contributor

What

North Star adoption #2 of the NOOA typed-return pattern (after MENTOR #22). The winniio-proposal golden rule"every client claim traces to a verbatim source, or it does not go in" — becomes a typed contract instead of prose discipline.

parse_appendix(rows, corpus) grounds every appendix row against the client's own words:

  • UngroundedClaim — quote not verbatim-present in the source it names ⇒ fabrication is a parse error.
  • MalformedRow — missing field, bad type, unknown source, or a SMILE stage outside the canonical six.

Why

Same shape that made a fabricated axiom a type error in MENTOR's judge, applied to proposals. PredictStrategy only — typed returns, no model-written code executed (the security-cleared NOOA mode; CodeAct stays quarantined).

Files (12)

  • src/proposal_engine/corpus.py (verbatim grounding + substantive-quote floor), appendix.py (the contract + to_markdown() canonical table), smile.py (6 stages as a Literal), api.py (thin FastAPI gate POST /appendix/validate, optional [api] extra — core has no web dep).
  • tests/ — contract, boundary, api.
  • GROUNDING.md, .gitignore.

Honest boundary (zero-gaslight)

The contract proves a quote is present, not faithfully represented — a recombined fragment (dropped negation) still grounds. Pinned in tests/test_boundary.py; the human roast remains the misquotation backstop. What it kills cold is pure invention.

Gates

✅ ruff clean · ✅ mypy clean · ✅ 26/26 pytest (contract + boundary + api).

Deliberately not built (KISS)

No auth, persistence, GraphQL, A2A, or vector DB. The generation loop stays in the winniio-proposal skill — this package is the gate that loop must pass before a proposal ships.

Note: branched off master; the existing README.md + web/ SPIN questionnaire live on chore/north-star-rename and are untouched (docs added as collision-free GROUNDING.md).

🤖 Generated with Claude Code

LifeAtlas and others added 2 commits July 25, 2026 11:40
North Star adoption #2 of the NOOA typed-return pattern (after MENTOR #22).
The winniio-proposal golden rule ("every client claim traces to a verbatim
source, or it does not go in") becomes a typed contract instead of a prose
discipline.

- corpus.py: SourceCorpus.contains() — verbatim (whitespace-normalized,
  case-preserved) presence in a NAMED client source, with a substantive-quote
  floor so a stopword can't ground a claim.
- appendix.py: parse_appendix(rows, corpus) -> GroundedProposal. A quote not
  verbatim in its named source raises UngroundedClaim; bad field/stage/source
  raises MalformedRow. to_markdown() renders the canonical appendix table
  unchanged.
- smile.py: the six SMILE stages as a validated Literal.
- api.py: thin FastAPI gate POST /appendix/validate (roadmap tier 3), optional
  [api] extra — core contract has no web dependency.

Honest boundary (zero-gaslight), pinned in test_boundary.py: the contract
proves presence, not faithful representation — a recombined fragment (dropped
negation) still grounds; the human roast remains the misquotation backstop.
What it kills cold is pure invention.

PredictStrategy only (typed returns, no code execution). ruff + mypy clean,
26/26 pytest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013wjiUfG6WqrvCFDrATiC9H
Self-roast of PR #549 flagged the real usability risk: exact-substring matching
would reject legitimate grounded quotes an LLM retyped with different
punctuation/case, and a gate that rejects real claims gets disabled.

_normalize now folds typographic punctuation (curly quotes, em/en dashes,
ellipsis, nbsp), collapses whitespace, and casefolds before comparison.
Forgiving on form, strict on substance — invented text still grounds in no
source under any normalization.

+3 tests (case, smart-quotes/dashes, invention-still-rejected). GROUNDING.md
documents the loosening and the still-unmeasured real-transcript false-reject
rate (fast-follow). ruff + mypy clean, 29/29.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013wjiUfG6WqrvCFDrATiC9H
@LifeAtlas
LifeAtlas merged commit 8b30be8 into master Jul 25, 2026
1 check passed
@LifeAtlas
LifeAtlas deleted the feat/proposal-engine-grounding branch July 25, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant