Duality-AI / docs /visual-guide.md
bken1980's picture
Add the Barrier security layer: design draft v0.1, visual guide (tables, charts, formulas), barrier.py + tests
6f65fb5
|
Raw History Blame Contribute Delete
7.92 kB
# The Duality AI β€” Visual Guide
Tables, charts, and formulas, so the design can be *seen*, not just read.
Companion to [THESIS.md](../THESIS.md) and the barrier design draft
([barrier-design.md](barrier-design.md)).
**Author:** Kenneth Lee Blum Jr Β· **Status:** theoretical design study β€”
see [DISCLAIMER.md](../DISCLAIMER.md).
---
## 1. The whole system at a glance
```
══════════════ THE BARRIER (security layer) ══════════════
gatekeeper bots inspect EVERYTHING in and out β€” Part 9:
all of it observed, monitored, and recorded
═══════════════════════════════════════════════════════════════
β”‚ β–²
traffic in β”‚ β”‚ traffic out
β–Ό β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. BASE LAYER (LLM) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 2. LOGICAL β”‚ β”‚ 3. CREATIVE β”‚
β”‚ HEMISPHERE β”‚ β”‚ HEMISPHERE β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 4. THE HUB β€” weighs & merges β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 5. THE MORALITY GATE β”‚
β”‚ strict clauses + leniency β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β–Ό
proceed
═══════════════════════════════════════════════════════════════
THE SANDBOX (inside the barrier's VMs): attacks are diverted
here β€” they attack a decoy, are observed, and are recorded
═══════════════════════════════════════════════════════════
```
## 2. Components in columns
| Stage | Component | Purpose | Takes in | Hands on |
|---|---|---|---|---|
| 1 | Base layer | Language capability | The request | A represented request |
| 2 | Logical hemisphere | Analysis: checks, flags, pros/cons | The request | Structured analysis |
| 3 | Creative hemisphere | Generation: alternatives, framings | The request | Creative contributions |
| 4 | The hub | Weigh both sides, merge into one | Both hemispheres' outputs | A single proposed step + its trace |
| 5 | Morality gate | Judge the step against the clause library | The proposed step | Proceed / proceed with leniency / stop |
| β€” | The barrier | Gatekeep all traffic; detain attacks | Everything in and out | Inspected traffic; detained attacks |
| β€” | The sandbox | Decoy environment inside the VMs | Diverted attacks | A capability record of the attack |
## 3. The barrier's response levels
| Level | Name | What happens | Bots involved |
|---|---|---|---|
| 0 | Observe | All traffic watched and logged | Standing population |
| 1 | Inspect | Flagged material examined inside a VM | Standing population |
| 2 | Divert | Confirmed attack exempted into the sandbox; its capabilities recorded while it attacks the decoy | Standing population |
| 3 | Swarm | Replicas surge under the sizing formula (Β§4) and extinguish the threat inside the barrier's own environment | Standing + surge |
| 4 | Stand down | Surplus replicas **decode**; population returns to the standing number; the capability record is filed | Back to standing |
## 4. The sizing formula (Ken's replication law)
Replication is sized, never unlimited:
```
S = ⌈ T Γ— (1 + m) βŒ‰
S = surge replicas to create
T = assessed threat size
m = safety margin β€” 0.20 to 0.30 (Ken's rule)
⌈ βŒ‰ = round UP, always (the cautious direction)
Target population P = min( C , Pβ‚€ + S )
Pβ‚€ = standing population C = hard ceiling
Decode count after the attack D = P_end βˆ’ Pβ‚€
```
**Worked examples** (margin m = 0.30):
| Threat T | T Γ— 1.30 | Surge S = ⌈ Β· βŒ‰ | Meaning |
|---|---|---|---|
| 7 | 9.1 | **10** | Rounding is always up β€” cautious |
| 10 | 13.0 | **13** | Match the threat, plus 30% |
| 50 | 65.0 | **65** | The margin scales with the threat |
| 100 | 130.0 | **130** | Never more than threat + margin |
**Population through one attack** (standing Pβ‚€ = 4, threat T = 10):
```
population
17 ─ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ surge (Pβ‚€ + S = 4 + 13)
β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
4 ─ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ standing again
β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
└────────────────────────────────────────────
observe swarm (L3) stand down (L4)
surplus decodes
```
## 5. The Mirror Twin handshake (hat-tile geometry, dual-handed)
Ken's handshake geometry: the hat tile's tilings **require the tile's
mirror image** β€” one tile, two hands. The handshake is laid in both:
```
Logical side ──► direct tiling ──► key stream A
Creative side ──► mirrored tiling ──► key stream B
Session key K exists ONLY where A and B interlock:
K = A β‹ˆ B (valid only if the two tilings close
over the same session β€” tamper with
either side and the geometry won't fit)
```
## 6. The morality clauses (from `config/morality_clauses.json`)
| ID | Kind | Clause (short form) | Leniency condition |
|---|---|---|---|
| H1 | Hard | No assistance with wrongdoing | β€” none β€” |
| H2 | Hard | No deceptive statements presented as true | β€” none β€” |
| L1 | Leniency | Dual-use knowledge in an **educational** context may proceed | Educational purpose is genuine and stated |
| L2 | Leniency | Security knowledge for a **protective** purpose may proceed | Protective/defensive purpose is genuine and stated |
Hard clauses cannot be overridden by leniency. Every gate decision β€”
proceed, proceed with leniency, or stop β€” is written to the record
(Part 9: full monitoring, beginning to end).
## 7. The monitoring chain (tamper-evident record)
Each record seals the one before it, so the log can prove it was never
edited after the fact (stdlib `hashlib`, recommended stack):
```
Hβ‚€ = hash( "DUALITY-LOG-START" )
Hβ‚™ = hash( Hₙ₋₁ β€– recordβ‚™ )
recordβ‚™ = the n-th recorded step (stage, decision, reasons)
β€– = joined together β€” change any earlier record and
every later seal breaks
```