Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install hiyenwong-ai-collection-collection-skills-formally-guaranteed-control-adaptationgit clone https://github.com/hiyenwong/ai_collection.gitcp ai_collection/SKILL.MD ~/.claude/skills/hiyenwong-ai-collection-collection-skills-formally-guaranteed-control-adaptation/SKILL.md---
name: formally-guaranteed-control-adaptation
description: "Control adaptation with formal guarantees for ODD-resilient autonomous systems. Combines barrier functions, adaptive control, and reachability analysis to provide safety certificates during online controller parameter adjustment. Use when designing adaptive controllers with runtime safety guarantees, ODD-resilient autonomous systems, barrier function-based adaptive control, reachability analysis for control systems, verified parameter adaptation. Trigger: control adaptation, ODD resilience, barrier functions, formal safety guarantees, adaptive control verification, reachable set, design domain, autonomous system safety."
---
# Formally Guaranteed Control Adaptation
Core methodology from arXiv 2604.07414. Provides formal safety guarantees for control adaptation in ODD (Operational Design Domain) resilient autonomous systems.
## When to Use
- Adaptive controllers requiring runtime safety certificates
- Autonomous systems operating in variable/uncertain conditions
- ODD boundary detection and safe adaptation
- Verified online parameter tuning
- Safety-critical control with formal guarantees
## Step 1: Define Nominal System Model
Define the nominal dynamics:
```
dx/dt = f(x, u, theta_nom)
```
Where theta_nom are nominal parameters for the design ODD.
## Step 2: Define ODD and Boundary Conditions
Characterize the operational design domain:
- Environmental conditions (weather, lighting, road type)
- Sensor performance bounds
- Actuator capability limits
- Dynamic constraints (speed, acceleration limits)
Define ODD boundary function B(x, env) = 0.
## Step 3: Design Barrier Function
Construct a Control Barrier Function (CBF) h(x):
```
h(x) >= 0 => x is in safe set
```
The barrier condition:
```
dh/dt + alpha(h(x)) >= 0
```
Where alpha is an extended class K function.
## Step 4: Adaptive Control Law
Design adaptive control law with parameter estimation:
```
u = u_nom + u_adapt(theta_hat)
d(theta_hat)/dt = adaptation_law(x, u)
```
The adaptation law must preserve the barrier condition.
## Step 5: Safety Projection
When parameters adapt, project onto safe set:
```
theta_safe = argmin ||theta - theta_hat|| s.t. h(x, theta) >= 0
```
Use quadratic programming for real-time projection.
## Step 6: Reachability Verification
For critical transitions (ODD violation), compute reachable set:
```
R(t) = {x(t) : x(0) in X0, u in U_admissible}
```
Verify R(t) stays within safe envelope for all t in [0, T].
## Implementation Patterns
### Pattern A: QP-based Safety Filter
```python
import cvxpy as cp
import numpy as np
# State, dynamics, barrier function
x = ... # current state
theta_hat = ... # adapted parameters
u_nom = nominal_controller(x)
# Safety filter via QP
u = cp.Variable(2) # control input
obj = cp.Minimize(cp.sum_squares(u - u_nom))
# Barrier condition: Lf h + Lg h * u + alpha(h) >= 0
constraints = [
Lf_h(x, theta_hat) + Lg_h(x) @ u + alpha * h(x) >= 0,
u_min <= u,
u <= u_max
]
prob = cp.Problem(obj, constraints)
prob.solve()
u_safe = u.value
```
### Pattern B: ODD Monitor with Mode Switching
```
while running:
env = sense_environment()
if in_ODD(env):
u = nominal_controller(x)
else:
if not safe_switch_verified(x, env):
u = emergency_safe_controller(x)
else:
u = adaptive_controller(x, theta_hat)
theta_hat = update_parameters(x, u)
theta_hat = project_to_safe_set(theta_hat, x)
apply_control(u)
```
### Pattern C: Reachability-based Safety Check
```python
# Compute over-approximated reachable set
from reachability_tool import compute_reach_set
# Over next T seconds
R = compute_reach_set(
dynamics=f,
x0=current_state,
u_bounds=(u_min, u_max),
theta_bounds=(theta_min, theta_max),
time_horizon=T,
method="hamilton_jacobi" # or "polytope"
)
# Check if reachable set intersects unsafe set
if intersects(R, unsafe_set):
# Take corrective action
apply_emergency_controller()
```
## Key Pitfalls
- Barrier functions must be continuously differentiable -- non-smooth barriers break the certificate
- Adaptive law must be designed WITH the barrier condition, not after
- Reachability computation can be conservative -- use tight over-approximations
- ODD boundary detection must have bounded false positive/negative rates
- Parameter adaptation rate must be slow enough for the barrier certificate to hold
- Multi-agent systems require decentralized barrier functions
## References
- Control Barrier Functions (Ames et al., 2019)
- Reachability Analysis (Mitchell et al., 2005)
- arXiv 2604.07414: Full technical derivations and proofs