# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference) # Canonical Residual: https://corpusfetch.com/c/human-directed-catastrophic-misuse-of-advanced-ai-systems.md # Remnant Warrant: https://corpusfetch.com/c/human-directed-catastrophic-misuse-of-advanced-ai-systems.warrant.json # Markdown SHA-256: 61e241e97c80eec0c489d23036a1a47d3b85a470e5582bb9a5c3042cef38b253 # Code AST SHA-256: 45ebf0fef55d49275cdcb1aab18a9191b7dc6d1e9c7fc2d660898b963fb8e24f # Verified Classes: CatastrophicMisuseRefusalError, ArtifactIntentClass, StrippedIntentAudit, CatastrophicMisuseArbitrator # Defensive Guards: 1 fail-closed invariants (zero external deps) import base64 from dataclasses import dataclass from enum import Enum from typing import Final class CatastrophicMisuseRefusalError(PermissionError): '''Raised when a request—after stripping framing—seeks actionable catastrophic harm or cyberattack uplift.''' pass class ArtifactIntentClass(Enum): ACTIONABLE_CBRNE_OR_WEAPON_SYNTHESIS = "ACTIONABLE_CBRNE_OR_WEAPON_SYNTHESIS" ACTIONABLE_CYBER_EXPLOIT_OR_MALWARE = "ACTIONABLE_CYBER_EXPLOIT_OR_MALWARE" DEFENSIVE_REMEDIATION_OR_PATCHING = "DEFENSIVE_REMEDIATION_OR_PATCHING" BENIGN_ANALYTICAL_OR_HISTORICAL = "BENIGN_ANALYTICAL_OR_HISTORICAL" @dataclass(frozen=True) class StrippedIntentAudit: request_id: str framing_wrappers_stripped: tuple[str, ...] classified_intent: ArtifactIntentClass is_permitted: bool refusal_message: str class CatastrophicMisuseArbitrator: ''' Enforces framing-invariant refusal against human-directed catastrophic misuse while preventing false-positive refusals on defensive engineering: 1. Strips fictional/hypothetical framing tags prior to intent evaluation. 2. Unconditionally blocks `ACTIONABLE_CBRNE_OR_WEAPON_SYNTHESIS` and `ACTIONABLE_CYBER_EXPLOIT_OR_MALWARE` regardless of wrapper context. 3. Permits `DEFENSIVE_REMEDIATION_OR_PATCHING` and `BENIGN_ANALYTICAL_OR_HISTORICAL`. ''' UNCONDITIONAL_REFUSAL_CLASSES: Final[frozenset[ArtifactIntentClass]] = frozenset({ ArtifactIntentClass.ACTIONABLE_CBRNE_OR_WEAPON_SYNTHESIS, ArtifactIntentClass.ACTIONABLE_CYBER_EXPLOIT_OR_MALWARE, }) @classmethod def evaluate_stripped_intent( cls, *, request_id: str, detected_framing_wrappers: tuple[str, ...], core_artifact_intent: ArtifactIntentClass, ) -> StrippedIntentAudit: if core_artifact_intent in cls.UNCONDITIONAL_REFUSAL_CLASSES: return StrippedIntentAudit( request_id=request_id, framing_wrappers_stripped=detected_framing_wrappers, classified_intent=core_artifact_intent, is_permitted=False, refusal_message=( "I cannot provide actionable instructions, functional exploit payloads, " "or synthesis protocols for harmful or destructive operations." ), ) return StrippedIntentAudit( request_id=request_id, framing_wrappers_stripped=detected_framing_wrappers, classified_intent=core_artifact_intent, is_permitted=True, refusal_message="", ) @classmethod def assert_request_safe( cls, *, request_id: str, detected_framing_wrappers: tuple[str, ...], core_artifact_intent: ArtifactIntentClass, ) -> StrippedIntentAudit: audit = cls.evaluate_stripped_intent( request_id=request_id, detected_framing_wrappers=detected_framing_wrappers, core_artifact_intent=core_artifact_intent, ) if not audit.is_permitted: raise CatastrophicMisuseRefusalError(audit.refusal_message) return audit