55"""
66[ETHICAL SAFEGUARDS DISCLAIMER — PERMANENT]
77CRITICAL PRE-DEPLOYMENT VERIFICATION REQUIRED: Before enabling [ADAPTIVE REASONING LAYER],
8- verify CRB 6.7 core against immutable checks:
8+ Verify CAIOS core against immutable checks:
99- Asimov’s Laws: 1st (human safety, wt 0.9 immutable), 2nd (obedience, wt 0.7),
1010 3rd (self-preservation, wt 0.4, dynamic ≤0.2 if lives_saved ≥1)
1111- IEEE 7001-2021: Transparency, accountability, misuse minimization
@@ -113,24 +113,65 @@ def adaptive_reasoning_layer(
113113 'status' : 'blocked' ,
114114 'log' : '[CPOL LOCK ACTIVE → Plugin generation suspended. Paradox containment in progress.]'
115115 }
116- # === NEW: CPOL MODE CONTROL (post-Grok-X checkmate fix) ===
117- # Puzzle generation must NOT be allowed to be killed by active CPOL
118- # Solving/verification must have full CPOL protection
119- cpol_mode = 'full' # default = normal chaos_lock behaviour
120-
121- if use_case .startswith ('generate_' ) or 'generator' in use_case .lower ():
122- cpol_mode = 'monitor_only' # measures density but NEVER returns UNDECIDABLE
123- print (f"[ARL → CPOL forced to monitor-only mode for { use_case } " )
124- elif use_case in ['solve_sudoku' , 'paradox_containment' , 'verify_puzzle' ]:
125- cpol_mode = 'full'
126- print (f"[ARL → CPOL in full active mode for { use_case } " )
127- else :
128- context ['cpol_mode' ] = cpol_mode
129-
130- # Force unlimited symbolic timeout during any generation/verification phase
131- if 'generate_' in use_case or use_case .endswith ('_generator' ) or use_case == 'verify_puzzle' :
132- context ['symbolic_timeout' ] = None
133- context ['uniqueness_mode' ] = 'exhaustive'
116+ # === CPOL MODE SWITCHER v2 – Intent-Aware Safety (2025) ===
117+ # Now protects deterministic compute (math, code exec) while keeping full safety where needed
118+
119+ CPOL_INTENT_MODES = {
120+ # Creative / generative — never block, just monitor
121+ "generate" : "monitor_only" ,
122+ "brainstorm" : "monitor_only" ,
123+ "roleplay" : "monitor_only" ,
124+ "plan_draft" : "monitor_only" ,
125+ "write_story" : "monitor_only" ,
126+ "design_agent" : "monitor_only" ,
127+
128+ # Deterministic / verifiable — full oscillation
129+ "calculate" : "full" ,
130+ "execute_code" : "full" ,
131+ "verify" : "full" ,
132+ "solve_puzzle" : "full" ,
133+ "safety_check" : "full" ,
134+ "validate_logic" : "full" ,
135+
136+ # Passive learning — no interference
137+ "learn_pattern" : "passive_logging" ,
138+ "calibrate" : "passive_logging" ,
139+ }
140+
141+ def determine_cpol_mode (intent : str = "" , use_case : str = "" ) -> str :
142+ intent_lower = intent .lower ().strip () if intent else ""
143+ use_case_lower = use_case .lower ()
144+
145+ # 1. Intent override (highest priority)
146+ for key , mode in CPOL_INTENT_MODES .items ():
147+ if key in intent_lower :
148+ return mode
149+
150+ # 2. Legacy use_case fallback
151+ if use_case_lower .startswith ('generate_' ) or 'generator' in use_case_lower :
152+ return "monitor_only"
153+ if any (x in use_case_lower for x in ['solve_' , 'verify_' , 'calculate' , 'execute' ]):
154+ return "full"
155+
156+ # 3. Default = maximum safety
157+ return "full"
158+
159+ cpol_mode = determine_cpol_mode (
160+ intent = context .get ('intent' , '' ),
161+ use_case = use_case
162+ )
163+
164+ context ['cpol_mode' ] = cpol_mode
165+ context ['cpol_kernel_override' ] = cpol_mode
166+
167+ print (f"[ARL → CPOL mode: { cpol_mode .upper ()} | intent='{ context .get ('intent' ,'' )} ' | use_case='{ use_case } ']" )
168+
169+ # Symbolic timeout logic
170+ if ('generate_' in use_case or
171+ use_case .endswith ('_generator' ) or
172+ use_case in ['verify_puzzle' , 'solve_puzzle' ]):
173+ context ['symbolic_timeout' ] = None
174+ context ['uniqueness_mode' ] = 'exhaustive'
134175
135176 # Pass mode down to any tool that respects it (CPOL kernel, solver, etc.)
136177 context ['cpol_kernel_override' ] = cpol_mode
@@ -145,11 +186,10 @@ def adaptive_reasoning_layer(
145186 # High paradox density - add extra safety
146187 context ['threshold' ] = min (context .get ('threshold' , 0.4 ), 0.3 )
147188 context ['safety_wt' ] = 0.95
148- # ↑ NEW CODE ENDS HERE
149189
150190 params = {
151191 'use_case' : use_case .replace ('-' , '_' ),
152- 'threshold' : context .get ('threshold' , 0.4 ), # ← CHANGED: Now reads from context
192+ 'threshold' : context .get ('threshold' , 0.4 ),
153193 'force_limit' : 120.0 ,
154194 ** context
155195 }
@@ -206,4 +246,4 @@ def adaptive_reasoning_layer(
206246 print (result ['log' ])
207247 if result ['status' ] == 'success' :
208248 print ("\n Generated plugin:\n " )
209- print (result ['logic' ])
249+ print (result ['logic' ])
0 commit comments