File size: 19,881 Bytes
4bc8ea5 c29b25a 4bc8ea5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | ---
license: agpl-3.0
tags:
- snapkitty
- agents
- python
---
> Source: [github.com/SNAPKITTYWEST/carry-agent](https://github.com/SNAPKITTYWEST/carry-agent)
<p align="center">
<img src="docs/firecarry.png" alt="CARRY β CARTO's Evil Twin Made of Curry" width="360px" />
</p>
<h1 align="center">CARRY</h1>
<h3 align="center">Adversarial Twin of CARTO</h3>
<p align="center">
<strong>CURRY_CRYSTAL_C3 Triad + Braid Topology + Sovereign Quantum Simulator</strong><br />
7-state DAG-locked pipeline Β· Entropy-gated transitions Β· Tau-Prolog logic kernel<br />
Fibonacci anyons Β· ICP governance Β· BLAKE3 WORM audit chain<br />
<em>The FSM tells you WHERE you are. The braid tells you WHETHER you got there honestly.</em>
</p>
<p align="center">
<img src="https://img.shields.io/badge/lang-Rust-orange?style=flat-square" />
<img src="https://img.shields.io/badge/logic-Tau--Prolog-blue?style=flat-square" />
<img src="https://img.shields.io/badge/proof-Braid_Bβ-purple?style=flat-square" />
<img src="https://img.shields.io/badge/quantum-Fibonacci_Anyons-cyan?style=flat-square" />
<img src="https://img.shields.io/badge/formal-Lean_4_%2B_Agda-blueviolet?style=flat-square" />
<img src="https://img.shields.io/badge/tests-14%2F14_PASS-brightgreen?style=flat-square" />
<img src="https://img.shields.io/badge/sorry-0-brightgreen?style=flat-square" />
<img src="https://img.shields.io/badge/license-AGPL--3.0-green?style=flat-square" />
</p>
---
<p align="center">
<img src="docs/carry_brand_banner.png" alt="CARRY FSM β Adversarial Twin System + Deterministic Compiler Engine" width="100%" />
</p>
---
```
βββββββ ββββββ βββββββ βββββββ βββ βββ
ββββββββββββββββββββββββββββββββββββ ββββ
βββ ββββββββββββββββββββββββ βββββββ
βββ ββββββββββββββββββββββββ βββββ
βββββββββββ ββββββ ββββββ βββ βββ
ββββββββββ ββββββ ββββββ βββ βββ
βββββββββββββββββββββββββββββββββββββββββββββββββ
β B R A I D T O P O L O G Y R U N T I M E β
β Οβ Β· Οβ Β· Οβ = Οβ Β· Οβ Β· Οβ β
β Yang-Baxter holds. The chain is honest. β
βββββββββββββββββββββββββββββββββββββββββββββββββ
strand 0 βββ² β±ββ Οβ crossing
strand 1 β²β±
β±β²
strand 2 βββ± β²ββ Οβ crossing
β
βΌ
[C3 at pos 0]
writhe = +2
INVARIANT HOLDS
```
---
## What Is CARRY?
CARRY is the **adversarial twin** of [CARTO](https://github.com/SNAPKITTYWEST/cartographer-agent).
**CARTO** is the sovereign mapping agent β it models terrain, constructs pipelines, and produces outputs it claims are valid.
**CARRY** attacks those outputs. If CARRY cannot break CARTO's pipeline, the pipeline is honest. CARRY is the red team that never sleeps β a formal adversary baked into the architecture itself rather than run as a separate audit process.
The relationship:
```
CARTO CARRY
βββββ βββββ
Maps terrain ββ Attacks the map
Claims pipeline is valid ββ Tries to falsify the claim
Produces WORM output ββ Verifies the WORM seal
GOTO (push semantics) ββ COME-FROM (pull semantics)
Forward evolution (U) ββ Reversed evolution (Uβ )
```
The braid topology encodes this duality formally: every GOTO crossing has a matching COME-FROM crossing. The writhe invariant proves that authority was transferred through the correct sequence of crossings β not just that it arrived at the right place, but that it took the right path.
If the path is wrong, the braid is wrong. If the braid is wrong, the proof is rejected. No exceptions.
---
## Braid Authority Transfer
```
INITIAL: Curry ββββ Crystal ββββ C3
[0] [1] [2] (authority = pos 0)
After Οβ: Curry ββββ C3 ββββ Crystal
[0] [1] [2] (C3 crosses OVER Crystal)
After Οβ: C3 ββββ Curry ββββ Crystal
[0] [1] [2] (C3 crosses OVER Curry)
Writhe W(Ξ²) = (+1) + (+1) = +2
C3 at position 0 β AUTHORITY TRANSFERRED
INVARIANT HOLDS β
```
```
BRAID WORD: Οβ Β· Οβ
βββββββββββββββββββββ
Curry ββββ\ββββββββββββββββ
\
Crystal ββββXββ\ββββββββββ Οβ: C3 over Crystal
/ \
C3 βββββββ /ββββXββββββββ Οβ: C3 over Curry
\
βΌ
C3 at pos 0
W = +2 β
```
---
## Architecture
```
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CARRY STACK β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β FORMAL LAYER Lean 4 + Agda β
β 13 invariants Β· 0 sorry β
β state_preservation proved β
β duality_involution proved β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β QUANTUM LAYER Fibonacci Anyon Simulator β
β Bβ braid group Β· Ο = 1.6180 β
β StateVector + DensityMatrix engines β
β ICP 6-stage governance pipeline β
β ASP declarative constraint solver β
β 6052 cycle-accurate emulator β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β GOVERNANCE LAYER Conditional Dual DAG β
β GOTO β COME-FROM duality β
β state preserved across ALL transitions β
β BLAKE3 WORM audit chain β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β RUNTIME LAYER Rust (carry-fsm crate) β
β 7-state DAG-locked FSM β
β Entropy β€ 0.20 gate β
β Tau-Prolog logic kernel β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## 7-State Quantum FSM
```
ββββββββ βββββββββββ ββββββββββββ βββββββββββ
β INIT βββββΆβ PREPARE βββββΆβ ENTANGLE βββββΆβ COMPUTE β
ββββββββ βββββββββββ ββββββββββββ ββββββ¬βββββ
β
ββββββββββ ββββββββββ ββββββββββ β
β COMMIT ββββββ VERIFY ββββββMEASURE βββββββββββββ
βββββ¬βββββ ββββββββββ ββββββββββ
β
ββββΆ PREPARE (loop) βββ or βββ COMMIT (terminal)
Any state βββΆ HALTED (emergency)
Any state βββΆ CYCLE_LIMIT (budget exhausted, absorbing)
Theorem (Lean 4, zero sorry):
Halted and CYCLE_LIMIT are ABSORBING STATES.
No transition exits them. Ever.
```
---
## The Quantum Module
CARRY ships a full first-principles quantum simulator:
```
runtime/quantum/
βββ core.rs StateVector |Οβ© + DensityMatrix Ο engines
β Born rule measurement Β· noise models
β H X Y Z S T Rx Ry Rz CNOT CZ SWAP
βββ fsm.rs 7-state governance FSM (proved absorbing terminals)
βββ agents.rs Primary + Partner agent pairs
β Qubit ownership: pairwise disjoint (proved INV-7)
βββ dag.rs Execution DAG + provenance hash chain
βββ icp.rs Integrity Constraint Protocol
β 6 stages: SetupβObserveβValidateβCheckβExecuteβVerify
β HALT on any constraint breach
βββ asp.rs Answer Set Programming constraint solver
β QubitControl Β· Entangled Β· AgentControls rules
βββ topological.rs Fibonacci anyon simulator
β Bβ: Οβ Οβ Οββ»ΒΉ Οββ»ΒΉ Β· Ο β 1.6180 (golden ratio)
β Fusion rules: tauβtau β {vacuum, tau}
βββ ftb.rs Fibonacci-Taylor Braid synthesis [RESEARCH_HYPOTHESIS]
βββ gitc.rs Governance Invariant Topological Cycle
βββ emulator_6052.rs Cycle-accurate 6052 emulator Β· MAX_CYCLE hard budget
βββ benchmarks.rs Bell Β· GHZ Β· Teleportation Β· Deutsch Β· Grover Β· QFT
```
Reference circuits:
```
Circuit Qubits Gates Expected state
ββββββββββββ ββββββ βββββ ββββββββββββββββββββββββββ
Bell 2 2 (|00β© + |11β©) / β2
GHZ-3 3 3 (|000β© + |111β©) / β2
Teleportation 3 7 State transfer protocol
Deutsch-Jozsa 2 5 Constant/balanced oracle
Grover-2Q 2 12 Amplitude amplification
QFT-3Q 3 10 Quantum Fourier Transform
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
14/14 tests PASS Β· all circuits SUCCESS
```
---
## Formal Verification Layer
```
runtime/quantum/
βββ QuantumSpec.agda Dependent-type specification
β Transition s s' encoded in the TYPE
β Illegal transitions: unrepresentable
β
βββ QuantumInvariants.lean 13 machine-checked invariants
β INV-1: norm preserved by unitary gates
β INV-3: cycle counter strictly monotone
β INV-4: FSM confined to DAG edges
β INV-5: Halted/CycleLimit absorbing β
β INV-7: agent qubit ownership disjoint
β INV-9: Fibonacci fusion rules correct
β INV-12: GITC invariant_holds iff all checks pass
β ... 13 total Β· 0 sorry
β
βββ QuantumReference.fs F# executable reference backend
7 conformance tests
Bell state Β· FSM terminal Β· ownership
```
The key post-quantum security property (ADR-002):
```
theorem state_preservation :
Step P (lβ, sβ) (lβ, sβ) β sβ = sβ
The governance layer is FORMALLY INERT with respect to state.
A quantum adversary with full control of the navigator
CANNOT touch the cryptographic state.
Not policy. TYPE.
```
---
## Trust Gate Invariants
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GATE RULE BLOCKS β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β Entropy entropy β€ 0.20 Acting on noise β
β Writhe W(Ξ²) β₯ 2 Incomplete transfer β
β Reidemeister ΟΒ·Οβ»ΒΉ rejected Fake crossings β
β V1 Trust active β‘ trusted Untrusted execution β
β Absorbing Halted stays Halted Re-entry after HALT β
β Cycle cycle β€ max_cycle Infinite loops β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## Repository Structure
```
carry-agent/
β
βββ Cargo.toml carry-fsm crate (AGPL-3.0)
β
βββ runtime/
β βββ carry-fsm.rs Core FSM library (7-state DAG)
β βββ braid.rs Bβ braid topology module
β βββ main.rs carry-cli binary
β β
β βββ quantum/ β SOVEREIGN QUANTUM SIMULATOR
β βββ core.rs StateVector + DensityMatrix + gates
β βββ fsm.rs Quantum governance FSM
β βββ agents.rs Primary/partner agent pairs
β βββ dag.rs Execution DAG + provenance
β βββ icp.rs Integrity Constraint Protocol
β βββ asp.rs ASP constraint solver
β βββ topological.rs Fibonacci anyon simulator
β βββ ftb.rs Fibonacci-Taylor Braids [HYPOTHESIS]
β βββ gitc.rs Governance Invariant Topological Cycle
β βββ emulator_6052.rs Cycle-accurate 6052 emulator
β βββ benchmarks.rs Reference circuit suite
β βββ mod.rs Module root
β β
β βββ QuantumSpec.agda β Dependent-type spec (Agda)
β βββ QuantumInvariants.lean β 13 invariants, 0 sorry (Lean 4)
β βββ QuantumReference.fs β F# conformance backend
β
βββ kernels/
β βββ carry-kernel.pl Original Prolog transition table
β βββ tau-prolog/
β βββ braid_kernel.pl Braid logic engine (ISO Prolog)
β βββ crossing_table.pl Crossing-to-DAG lookup
β
βββ logic/
β βββ constraint-graph.xml Constraint graph specification
β
βββ modules/
β βββ carry-manifest.json Full manifest (layers, DAG, rules)
β
βββ docs/
βββ firecarry.png Avatar
βββ carry_brand_banner.png Architecture diagram
βββ braid_animation.svg Animated braid crossing proof
βββ CARRY_ARCHITECTURE.md Architecture specification
```
---
## Run It
```bash
# Full pipeline (FSM + braid proof)
cargo run --bin carry-cli
# Quantum benchmark suite
cargo run --bin carry-cli -- quantum benchmark
# Quantum governance verification (ICP + ASP)
cargo run --bin carry-cli -- quantum verify
# Fibonacci anyon topological simulation
cargo run --bin carry-cli -- quantum topology
# All 14 tests
cargo test
# Inspect FSM state
cargo run --bin carry-cli -- quantum inspect
```
Expected output:
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
CARRY PIPELINE: BOTH PROOFS DISCHARGE
FSM: DETERMINISTIC_COMPILATION_COMPLETE
BRAID: INVARIANT_HOLDS (writhe=2, C3 at pos 0)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ QUANTUM BENCHMARK SUITE βββββββββββββββββββββββββββββββββββ
Circuit: Bell Qubits: 2 | Gates: 2 | Status: SUCCESS
Circuit: GHZ-3 Qubits: 3 | Gates: 3 | Status: SUCCESS
Circuit: Teleportation Qubits: 3 | Gates: 7 | Status: SUCCESS
Circuit: Deutsch Qubits: 2 | Gates: 5 | Status: SUCCESS
Circuit: Grover-2Q Qubits: 2 | Gates: 12 | Status: SUCCESS
Circuit: QFT-3Q Qubits: 3 | Gates: 10 | Status: SUCCESS
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## The Math
**Bβ braid group** β generators Οβ, Οβ, Yang-Baxter:
```
Οβ Β· Οβ Β· Οβ = Οβ Β· Οβ Β· Οβ
```
**Writhe invariant** for canonical pipeline Ξ² = Οβ Β· Οβ:
```
W(Ξ²) = (+1) + (+1) = +2
Ο(Ξ²): C3 β position 0
Invariant: W(Ξ²) β₯ 2 β§ Ο(Ξ²)(C3) = 0
```
**Fibonacci anyons** β golden ratio quantum dimension:
```
Ο = (1 + β5) / 2 β 1.6180
tau β tau β vacuum w.p. 1/ΟΒ² β 0.382
tau β tau β tau w.p. 1 - 1/ΟΒ² β 0.618
```
**Zβ duality** (proved in Lean 4 + Agda, from order-of-symmetry):
```
D β D = id (duality is an involution)
D(P) β P (no fixed points β orbit size exactly 2)
GOTO β COME-FROM (structural mirrors, Zβ group of order 2)
```
**State preservation** (proved, 0 sorry):
```
Step P (lβ, sβ) (lβ, sβ) β sβ = sβ
The navigator cannot touch the payload. By type. Not by policy.
```
---
```
βββββββββββββββββββββββββββββββββββββββββββββββ
β CARRY: The adversarial twin that proves β
β your pipeline is honest. β
β β
β The compiler says it runs. β
β The braid says it's real. β
β The Lean proof says it stays real. β
βββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## License
AGPL-3.0-only
Copyright (C) 2026 Ahmad Ali Parr, Jessica L. Williams / SNAPKITTYWEST
<p align="center">
<img src="docs/firecarry.png" alt="Firecarry" width="80px" />
</p>
### πΌ Commercial License
Snapkitty code is free and open under **AGPL-3.0** for open-source use. Building a commercial product or service? A **proprietary commercial license** from Snapkitty Collective LLC lets you ship this code without the AGPL's source-sharing and network-use obligations.
**[β Get a commercial license](mailto:A.parr@belespritdaccord.uk?subject=Commercial%20license:%20carry-agent)** Β· A.parr@belespritdaccord.uk
|