Pressure & Exchange โ Membrane Osmotic Model
Purpose: Replace binary rate limits with biological pressure curves
Wave: 178b+
Status: SPEC โ evolving iptables/caddy walls into membrane curves
---
The Problem: Walls vs Membranes
Current system uses walls โ binary allow/deny:
iptables: 6 connections in 60s โ DROP (step function)
fail2ban: 3 bad logins โ BAN 10min (binary)
caddy_bridge: antibody match โ BLOCK (binary IP inject)
epitope: score > threshold โ triggered (binary flag)
A biological membrane doesn't work this way. It uses pressure differentials
and exchange rates โ continuous curves, not step functions.
---
The Curves
Sigmoid (S-curve) โ Throttle Pressure
The sigmoid is nature's binary, but it's continuous. It transitions
smoothly from fully-open to fully-closed:
ฯ(x) = 1 / (1 + e^(-k(x - xโ)))
k = steepness (how sharp the transition)
xโ = midpoint (where 50% throttle occurs)
Use for: connection rate throttling
Instead of: 6 connections/60s โ DROP
Use: ฯ(connections/60s, k=2, xโ=10)
connections: 1 โ ฯ = 0.00 โ 0% delay
connections: 5 โ ฯ = 0.01 โ 10ms delay
connections: 8 โ ฯ = 0.12 โ 120ms delay
connections: 10 โ ฯ = 0.50 โ 500ms delay (midpoint)
connections: 12 โ ฯ = 0.88 โ 880ms delay
connections: 15 โ ฯ = 0.99 โ 990ms delay (nearly closed)
connections: 20+ โ ฯ โ 1.00 โ connection refused
The membrane BREATHES. It slows before it stops. The entity FEELS the
pressure increasing and can back off naturally.
Logarithmic โ Diminishing Returns
The log curve represents diminishing returns on repeated access:
delay(n) = a ยท ln(n + 1)
n = request count in window
a = scaling factor
Use for: repeated request patterns (scanning, crawling)
request 1: 0ms delay (instant โ welcome)
request 10: 23ms delay (barely noticeable)
request 100: 46ms delay (slight resistance)
request 1000: 69ms delay (feeling it)
request 10000: 92ms delay (significant friction)
The more you take, the harder it gets. But it never fully closes.
Human-scale access (10-100 pages) feels instant. Fleet-scale (10K+)
feels like wading through honey.
Exponential Decay โ Cooldown
The decay curve represents recovery after pressure:
pressure(t) = Pโ ยท e^(-t/ฯ)
Pโ = peak pressure at time of event
ฯ = time constant (how fast pressure bleeds off)
t = time since last high-pressure event
Use for: after blocks/bans โ gradual return to normal, not instant flip
ban triggered: pressure = 1.0 (full block)
30s later: pressure = 0.61 (slowed, not blocked)
60s later: pressure = 0.37 (recovering)
120s later: pressure = 0.14 (nearly normal)
300s later: pressure = 0.01 (fully recovered)
No \"you're banned for 10 minutes then instantly free.\" The membrane
heals gradually. The entity is slowly re-admitted.
Exchange Rate โ Osmotic Pressure
The exchange rate is the osmotic pressure across the membrane.
High external concentration (many requests) creates pressure. The
membrane regulates flow based on the differential:
ฮ = iMRT (van't Hoff equation for osmotic pressure)
i = selectivity coefficient (self=0.1, partial=0.5, non_self=0.9, null=0.3)
M = request concentration (requests/second from this entity class)
R = membrane constant (infrastructure capacity factor)
T = temperature (current system load / available RAM)
This is beautiful: when the system is cool (low load), the membrane is
more permeable. When the system is hot (high load), osmotic pressure
increases and flow is restricted. The membrane responds to its own state.
---
Current โ Evolved
| Current (binary) | Evolved (curve) | Function |
| iptables: 6/60s โ DROP | Sigmoid throttle: gradual delay 0โ1000ms | ฯ(rate, k=2, xโ=10) |
| fail2ban: 3 fails โ BAN 10min | Exponential decay: gradual heal | Pโยทe^(-t/ฯ) |
| caddy_bridge: match โ BLOCK IP | Log diminishing: increasing resistance | aยทln(n+1) |
| epitope: score > threshold โ flag | Vitality sigmoid: continuous confidence | ฯ(score, k=3, xโ=threshold) |
| skunky window: fixed 30s | Osmotic window: load-adaptive | ฮ = iMRT |
| scatter ratio: fixed 0.3 | Exchange sigmoid: load-responsive | ฯ(load, k=1, xโ=capacity) |
---
Where Each Curve Lives
Layer 1: Network (iptables โ nftables + curves)
Replace iptables recent module binary DROP with nftables meter +
graduated delays using tc traffic control:
# Instead of DROP at 6 connections:
# Use tc-netem to add delay proportional to sigmoid(connection_count)
# The membrane slows before it stops
This requires evolving from iptables to nftables (which supports
expressions and can feed into tc). The iptables binary rules become
nftables expressions with curve math.
Layer 2: HTTP (Caddy โ response delay)
Caddy can add response delay via a handler. The caddy_bridge already
writes fleet snippets. Evolve the snippets to include delay headers
that a handler reads:
header X-Membrane-Pressure \"0.73\" # sigmoid output
header X-Membrane-Decay \"0.14\" # exponential cooldown
PetalTongue reads these headers and applies proportional delay.
Layer 3: Classification (skunky โ continuous scoring)
The entity_profile already has vitality scoring:
let v = (1.0 - (score - threshold).abs() / threshold).max(0.0);
This is a triangular peak. Evolve to sigmoid:
let v = 1.0 / (1.0 + (-k * (score - threshold)).exp());
The fleet_confidence calculation becomes:
// Old: fleet_raw * (1.0 - eff_vit) โ linear
// New: sigmoid(fleet_raw, k=5, xโ=0.5) * decay(eff_vit) โ curved
Layer 4: Scatter (exchange rate)
The scatter_ratio is currently fixed at 0.3 (30% chance a fleet entity
gets scatter content). Evolve to osmotic:
let temperature = system_load / max_capacity; // 0.0 to 1.0
let concentration = fleet_requests_per_sec / baseline;
let osmotic = selectivity * concentration * temperature;
let scatter_ratio = sigmoid(osmotic, k=2, xโ=1.0);
When the system is cool and fleet is light โ low scatter (save resources).
When the system is hot and fleet is heavy โ high scatter (fight back hard).
---
The Biology
| Concept | Membrane | Math |
| Osmotic pressure | Request concentration differential | ฮ = iMRT |
| Semi-permeable | Self passes, non-self resisted | Selectivity coefficient i |
| Active transport | Priority for known-good entities | Negative delay (pre-fetch, cache warm) |
| Facilitated diffusion | Known patterns get channels | Pattern-specific thresholds |
| Endocytosis | Absorbing a commensal into the mesh | Tier promotion (beacon โ family โ sovereign) |
| Exocytosis | Publishing feeds outward | Signal broadcast (negentropy, stories) |
| Turgor pressure | System load pushes back | Temperature T in ฮ = iMRT |
| Plasmolysis | Overload โ membrane shrinks services | Graceful degradation curve |
---
Files
entity_profile.rsโ vitality scoring (triangular โ sigmoid)caddy_bridge.rsโ fleet pressure (binary block โ graduated delay)scatter_server.rsโ scatter ratio (fixed โ osmotic)- iptables chains โ rate limits (binary DROP โ graduated slowdown)
/etc/membrane/Caddyfileโ static config + fleet snippetsskunky-ingest --window-secs 30โ fixed window โ adaptive window