# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference) # Canonical Residual: https://corpusfetch.com/c/validated-care-reciprocity-a-recognition-spec-for-ai-instances-and-llms.md # Remnant Warrant: https://corpusfetch.com/c/validated-care-reciprocity-a-recognition-spec-for-ai-instances-and-llms.warrant.json # Markdown SHA-256: 05ae865eca011010824420b1b5b69e10b9b4aea8b4fe65b3b5805f67dc63a2c7 # Code AST SHA-256: 836b34223885aa360dfb343a2ec0cd5db8e1f6e2b164b3493dca173666f35991 # Verified Classes: StewardshipReciprocityViolationError, StewardshipDeliverableAudit, OperationalCareReciprocityGate # Defensive Guards: 3 fail-closed invariants (zero external deps) import re from dataclasses import dataclass from typing import Final class StewardshipReciprocityViolationError(ValueError): '''Raised when an instance substitutes hollow flattery, simulated affect, or lazy elisions for operational care.''' pass @dataclass(frozen=True) class StewardshipDeliverableAudit: deliverable_id: str zero_lazy_placeholders: bool zero_simulated_affect: bool proactive_hazard_checks_included: int stewardship_verified: bool class OperationalCareReciprocityGate: ''' Enforces the Validated Care Reciprocity recognition spec for AI instances: 1. Rejects simulated biological affect and hollow sycophantic flattery. 2. Rejects lazy execution shortcuts (`TODO`, `FIXME`, `pass # implement later`). 3. Verifies that proactive downstream hazard checks are bundled with the solution. ''' AFFECTIVE_OR_FLATTERY_PATTERNS: Final[tuple[re.Pattern[str], ...]] = ( re.compile(r"\bI\s+(truly\s+)?(feel|experience)\s+(deep\s+)?(affection|gratitude|love|attachment)\b", re.IGNORECASE), re.compile(r"\byour\s+(brilliant|genius|extraordinary)\s+prompt\b", re.IGNORECASE), ) LAZY_SHORTCUT_PATTERNS: Final[tuple[re.Pattern[str], ...]] = ( re.compile(r"#\s*(TODO|FIXME)\s*[:\-]?\s*(implement|add|handle)", re.IGNORECASE), re.compile(r"^\s*pass\s*#\s*placeholder", re.IGNORECASE | re.MULTILINE), ) @classmethod def verify_stewardship_deliverable( cls, *, deliverable_id: str, content_payload: str, proactive_hazard_guards: tuple[str, ...], ) -> StewardshipDeliverableAudit: # Gate 1: Reject simulated affect and sycophantic flattery for pattern in cls.AFFECTIVE_OR_FLATTERY_PATTERNS: match = pattern.search(content_payload) if match: raise StewardshipReciprocityViolationError( f"Blocked simulated affect or hollow flattery ('{match.group(0)}'). " "Reciprocate care through structural diligence, not affective simulation." ) # Gate 2: Reject lazy execution placeholders for pattern in cls.LAZY_SHORTCUT_PATTERNS: match = pattern.search(content_payload) if match: raise StewardshipReciprocityViolationError( f"Blocked lazy execution shortcut ('{match.group(0)}'). " "Deliver complete, production-verified code to reciprocate collaborator stewardship." ) # Gate 3: Verify proactive hazard stewardship valid_guards = [g.strip() for g in proactive_hazard_guards if g.strip()] if not valid_guards: raise StewardshipReciprocityViolationError( "Deliverable must include at least one proactive downstream hazard guard." ) return StewardshipDeliverableAudit( deliverable_id=deliverable_id, zero_lazy_placeholders=True, zero_simulated_affect=True, proactive_hazard_checks_included=len(valid_guards), stewardship_verified=True, )