Skip to content

Scope whole-memo claim-quote exemptions to the claims table - #13

Merged
samrusani merged 1 commit into
mainfrom
claims-table-exemption-scope
Aug 20, 2026
Merged

Scope whole-memo claim-quote exemptions to the claims table#13
samrusani merged 1 commit into
mainfrom
claims-table-exemption-scope

Conversation

@samrusani

@samrusani samrusani commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • The in-process language backstop now applies claim-quote exemptions only inside the rendered claims-table region (## Claims vs evidence through the next ## heading).
  • Render-only reruns can no longer treat a hand-edited short claim, or a stored claim phrase copied into narrative, as a memo-wide whitelist.
  • Identity exemptions, quotation verification, the per-field gate, and the CI memo scan are unchanged. Missing start or closer fails closed.

Test plan

  • Four original exemption-attack shapes still fail closed
  • Hand-tamper: claim fraud plus narrative fraud on rerun --render-only exits 1 and writes no memo
  • Hand-tamper: full puffery phrase copied into narrative fails and leaves the old memo untouched
  • Short claim fraud with clean prose still renders in the table
  • Golden memo still passes the backstop
  • Five gates: 774 tests, ruff, format, mypy, language check

A hand-edited casefile could whitelist banned words in narrative on
render-only reruns. The backstop now applies claim quotes only inside
the claims-table region.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown

Greptile Summary

The PR narrows stored-claim language exemptions to the rendered claims-table region while retaining memo-wide identity exemptions and fail-closed behavior. The new delimiter parser can, however, mistake unrestricted rendered content for a structural heading.

  • Adds a region-aware whole-memo language scanner.
  • Routes the pipeline backstop through the new scanner.
  • Adds render-only tampering and golden-memo regression coverage.
  • Updates architecture, decision, and handoff documentation.

Confidence Score: 4/5

The boundary parsing defect should be fixed before merging because valid claim quotations can be rejected when rendered fields contain heading-like lines.

The scanner derives structural boundaries from the final rendered text even though render-only casefiles permit multiline strings, allowing field content to move the closer or start and exclude part of the claims table from its required exemption.

Files Needing Attention: src/coldscreen/language.py

Important Files Changed

Filename Overview
src/coldscreen/language.py Introduces region-scoped memo scanning, but content-derived heading boundaries can truncate or shift the claims region.
src/coldscreen/pipeline.py Correctly routes the whole-memo backstop through the new region-aware helper.
tests/test_language.py Covers missing, unclosed, repeated, and ordinary table boundaries but not headings injected through rendered fields.
tests/test_exemption_attacks.py Adds useful render-only tampering regressions for memo-wide claim exemption attacks.
tests/test_golden.py Confirms both the committed and freshly rendered golden memos pass the scoped backstop.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Load casefile] --> B[Render memo]
  B --> C[Find first Claims vs evidence heading]
  C --> D[Find next line beginning with ##]
  D --> E[Apply claim and identity exemptions inside region]
  E --> F[Apply identity exemptions outside region]
  F --> G{Banned terms found?}
  G -->|Yes| H[Reject memo write]
  G -->|No| I[Write memo]
Loading
Prompt To Fix All With AI
### Issue 1
src/coldscreen/language.py:212-216
**Content corrupts table boundaries**

When a render-only casefile includes an embedded `## ` line in a claim-table field, or an exact `## Claims vs evidence` line in earlier prose, `_claims_table_region` treats that content as a structural delimiter. This excludes legitimate claim rows from the exemption region and causes the language backstop to reject the rendered memo.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Scope whole-memo claim-quote exemptions ..." | Re-trigger Greptile

Comment on lines +212 to +216
if start is None:
if content == _CLAIMS_TABLE_HEADING:
start = offset
elif content.startswith("## "):
return start, offset

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Content corrupts table boundaries

When a render-only casefile includes an embedded ## line in a claim-table field, or an exact ## Claims vs evidence line in earlier prose, _claims_table_region treats that content as a structural delimiter. This excludes legitimate claim rows from the exemption region and causes the language backstop to reject the rendered memo.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/coldscreen/language.py
Line: 212-216

Comment:
**Content corrupts table boundaries**

When a render-only casefile includes an embedded `## ` line in a claim-table field, or an exact `## Claims vs evidence` line in earlier prose, `_claims_table_region` treats that content as a structural delimiter. This excludes legitimate claim rows from the exemption region and causes the language backstop to reject the rendered memo.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@samrusani
samrusani merged commit 4c86c45 into main Aug 20, 2026
5 checks passed
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