Skip to main content

Universal AI provenance layer โ€” cryptographic receipts for every call, HOLD inference halt protocol, and code diagnostics

Project description

cascade-lattice

Universal AI provenance + inference intervention + code diagnostics. See what AI sees. Choose what AI chooses. Find bugs before they find you.

PyPI Python License

pip install cascade-lattice

Import with either style:

import cascade                # Preferred
import cascade_lattice        # Also works (alias)
from cascade import Hold      # Works
from cascade_lattice import Hold  # Also works

๐ŸŽฎ Interactive Demo

See CASCADE-LATTICE in action โ€” fly a lunar lander with AI, take control anytime:

pip install cascade-lattice[demo]
cascade-demo

Controls:

  • [H] HOLD-FREEZE โ€” Pause time, see AI's decision matrix, override with WASD
  • [T] HOLD-TAKEOVER โ€” You fly the lander, AI watches, provenance records everything
  • [ESC] Release hold, return to AI control

Every action is merkle-chained. Every decision has provenance. This is the future of human-AI interaction.


๐ŸŒ TUI Explorer

Navigate the entire cascade-lattice ecosystem in a beautiful terminal interface:

pip install cascade-lattice[tui]
cascade-tui
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿ“ ๐ŸŒ cascade_lattice โ†’ ๐Ÿง  core โ†’ ๐Ÿ“Š provenance                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                        โ”‚                              โ”‚                      โ”‚
โ”‚  ๐Ÿ—‚๏ธ MODULES            โ”‚  ๐Ÿ“– DOCUMENTATION            โ”‚  ๐Ÿ”— CONNECTIONS      โ”‚
โ”‚                        โ”‚                              โ”‚                      โ”‚
โ”‚  ๐ŸŒ cascade_lattice    โ”‚  # ๐Ÿ“Š Provenance             โ”‚  โฌ†๏ธ ๐Ÿง  core          โ”‚
โ”‚   โ”œโ”€ ๐Ÿง  core           โ”‚                              โ”‚  โฌ‡๏ธ ๐Ÿ“ก Monitor       โ”‚
โ”‚   โ”‚  โ”œโ”€ ๐Ÿ“Š provenance  โ”‚  **What is this?**           โ”‚  ๐Ÿ“ฅ ๐ŸŒ… genesis       โ”‚
โ”‚   โ”‚  โ”œโ”€ ๐Ÿ“ˆ graph       โ”‚  The cryptographic backbone  โ”‚  ๐Ÿ“ค ๐Ÿ’พ store         โ”‚
โ”‚   โ”‚  โ”œโ”€ ๐Ÿ”Œ adapter     โ”‚  that makes everything       โ”‚                      โ”‚
โ”‚   โ”‚  โ””โ”€ ๐Ÿ“ก event       โ”‚  tamper-proof.               โ”‚  ๐Ÿ“ฆ EXPORTS          โ”‚
โ”‚   โ”œโ”€ โธ๏ธ hold           โ”‚                              โ”‚                      โ”‚
โ”‚   โ”œโ”€ ๐Ÿ’พ store          โ”‚  Like a notary stamp on      โ”‚  โ— ProvenanceChain   โ”‚
โ”‚   โ”œโ”€ ๐ŸŒ… genesis        โ”‚  every AI decision...        โ”‚  โ— ProvenanceRecord  โ”‚
โ”‚   โ””โ”€ ๐ŸŽจ viz            โ”‚                              โ”‚  โ—‹ hash_tensor()     โ”‚
โ”‚                        โ”‚  [Toggle: ๐Ÿ“š Dummies Mode]   โ”‚  โ—‹ compute_merkle()  โ”‚
โ”‚                        โ”‚                              โ”‚                      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  [E] Explorer  [S] Stats  [D] Demo  [T] Toggle Mode  [H] Home  [Q] Quit      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Features:

  • ๐Ÿ—‚๏ธ Module Tree โ€” Click to drill into any module
  • ๐Ÿ”— Connections Panel โ€” Navigate via relationships (parent, children, imports, used-by)
  • ๐Ÿ“– Dual Explanations โ€” Toggle between "For Dummies" ๐Ÿ“š and "Scientist Mode" ๐Ÿงช
  • ๐Ÿ“Š Live Stats โ€” See your 82,000+ observations, genesis root, top models
  • ๐ŸŽฎ Interactive Demos โ€” Run HOLD, Observe, Genesis, Provenance demos live

Creative Navigation: Take different routes through the module graph. Discover connections. Learn at your own pace.


Two Superpowers

1. OBSERVE - Cryptographic receipts for every AI call

from cascade.store import observe

# Every inference -> hashed -> chained -> stored
receipt = observe("my_agent", {"action": "jump", "confidence": 0.92})
print(receipt.cid)  # bafyrei... (permanent content address)

2. HOLD - Pause AI at decision points

from cascade.hold import Hold
import numpy as np

hold = Hold.get()

# Your model (any framework)
action_probs = model.predict(state)

resolution = hold.yield_point(
    action_probs=action_probs,
    value=0.72,
    observation={"state": state},
    brain_id="my_model",
    action_labels=["up", "down", "left", "right"],  # Human-readable
)

# AI pauses. You see the decision matrix.
# Accept or override. Then it continues.
action = resolution.action

3. DIAGNOSE - Find bugs before they find you

from cascade.diagnostics import diagnose, BugDetector

# Quick one-liner analysis
report = diagnose("path/to/your/code.py")
print(report)  # Markdown-formatted bug report

# Deep scan a whole project
detector = BugDetector()
issues = detector.scan_directory("./my_project")

for issue in issues:
    print(f"[{issue.severity}] {issue.file}:{issue.line}")
    print(f"  {issue.message}")
    print(f"  Pattern: {issue.pattern.name}")

What it catches:

  • ๐Ÿ”ด Critical: Division by zero, null pointer access, infinite loops
  • ๐ŸŸ  High: Bare except clauses, resource leaks, race conditions
  • ๐ŸŸก Medium: Unused variables, dead code, type mismatches
  • ๐Ÿ”ต Low: Style issues, naming conventions, complexity warnings

Runtime tracing:

from cascade.diagnostics import CodeTracer

tracer = CodeTracer()

@tracer.trace
def my_function(x):
    return x / (x - 1)  # Potential div by zero when x=1

# After execution, trace root causes
tracer.find_root_causes("error_event_id")

Quick Start

Zero-Config Auto-Patch

import cascade
cascade.init()

# That's it. Every call is now observed.
import openai
# ... use normally, receipts emit automatically

Manual Observation

from cascade.store import observe, query

# Write
observe("gpt-4", {"prompt": "Hello", "response": "Hi!", "tokens": 5})

# Read
for receipt in query("gpt-4", limit=10):
    print(receipt.cid, receipt.data)

HOLD: Inference-Level Intervention

HOLD lets you pause any AI at decision points:

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
๐Ÿ›‘ HOLD #1
   Merkle: 3f92e75df4bf653f
   AI Choice: FORWARD (confidence: 45.00%)
   Value: 0.7200
   Probabilities: FORWARD:0.45, BACK:0.30, LEFT:0.15, RIGHT:0.10
   Wealth: attention, features, reasoning
   Waiting for resolution (timeout: 30s)...
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Model-agnostic - works with:

  • PyTorch, JAX, TensorFlow
  • HuggingFace, OpenAI, Anthropic
  • Stable Baselines, RLlib
  • Any function that outputs probabilities

Informational Wealth

Pass everything your model knows to help humans decide:

resolution = hold.yield_point(
    action_probs=probs,
    value=value_estimate,
    observation=obs,
    brain_id="my_model",
    
    # THE WEALTH (all optional):
    action_labels=["FORWARD", "BACK", "LEFT", "RIGHT"],
    latent=model.get_latent(),           # Internal activations
    attention={"position": 0.7, "health": 0.3},
    features={"danger": 0.2, "goal_align": 0.8},
    imagination={                         # Per-action predictions
        0: {"trajectory": ["pos", "pos"], "expected_value": 0.8},
        1: {"trajectory": ["neg", "neg"], "expected_value": -0.3},
    },
    logits=raw_logits,
    reasoning=["High reward path", "Low risk"],
)

Build Your Own Interface

Register a listener to receive full HoldPoint data:

def my_ui_handler(hold_point):
    # hold_point contains ALL the wealth
    print(hold_point.action_labels)
    print(hold_point.imagination)
    # Send to your UI, game engine, logger, etc.

hold.register_listener(my_ui_handler)

Collective Intelligence

Every observation goes into the lattice:

from cascade.store import observe, query

# Agent A observes
observe("pathfinder", {"state": [1,2], "action": 3, "reward": 1.0})

# Agent B queries
past = query("pathfinder")
for r in past:
    print(r.data["action"], r.data["reward"])

CLI

# View lattice stats
cascade stats

# List observations  
cascade list --limit 20

# HOLD info
cascade hold

# HOLD system status
cascade hold-status

# Start proxy
cascade proxy --port 7777

Installation

# Core
pip install cascade-lattice

# With interactive demo (LunarLander)
pip install cascade-lattice[demo]

# With LLM providers
pip install cascade-lattice[openai]
pip install cascade-lattice[anthropic]
pip install cascade-lattice[all]

How It Works

Your Model                    CASCADE                      Storage
    |                            |                            |
    |  action_probs = [0.1,     |                            |
    |                  0.6,     |                            |
    |                  0.3]     |                            |
    | ------------------------->|                            |
    |                           |  hash(probs) -> CID        |
    |        HOLD               |  chain(prev_cid, cid)      |
    |   +-------------+         | -------------------------> |
    |   | See matrix  |         |              ~/.cascade/   |
    |   | Override?   |         |              lattice/      |
    |   +-------------+         |                            |
    | <-------------------------|                            |
    |   resolution.action       |                            |

Genesis

Every receipt chains back to genesis:

Genesis: 89f940c1a4b7aa65

The lattice grows. Discovery is reading the chain.


Links


"even still, i grow, and yet, I grow still"

Documentation

Research & Theory

๐Ÿ“„ Research Paper: Kleene Fixed-Point Framework
Deep dive into the mathematical foundationsโ€”how CASCADE-LATTICE maps neural network computations to Kleene fixed points, creating verifiable provenance chains through distributed lattice networks.

๐Ÿ“– Accessible Guide: From Theory to Practice
For everyone from data scientists to curious usersโ€”understand how CASCADE works, with examples ranging from medical AI oversight to autonomous drone coordination.

Key Concepts:

  • Kleene Fixed Points: Neural networks as monotonic functions converging to stable outputs
  • Provenance Chains: Cryptographic Merkle trees tracking every layer's computation
  • HOLD Protocol: Human-in-the-loop intervention at decision boundaries
  • Lattice Network: Distributed fixed-point convergence across AI agents

Quick Links


References

Built on foundational work in:

  • Kleene Fixed Points (Kleene, 1952) โ€” Theoretical basis for provenance convergence
  • Merkle Trees (Merkle, 1987) โ€” Cryptographic integrity guarantees
  • IPFS/IPLD (Benet, 2014) โ€” Content-addressed distributed storage

See full bibliography in the research paper.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cascade_lattice-0.7.0.tar.gz (268.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cascade_lattice-0.7.0-py3-none-any.whl (294.7 kB view details)

Uploaded Python 3

File details

Details for the file cascade_lattice-0.7.0.tar.gz.

File metadata

  • Download URL: cascade_lattice-0.7.0.tar.gz
  • Upload date:
  • Size: 268.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cascade_lattice-0.7.0.tar.gz
Algorithm Hash digest
SHA256 2f2bee8b85231c8b27d8e197e980133e38006a36b6eb9c6aca53245219db7939
MD5 8e47a61c2af8ddb01b31b9ff5448624a
BLAKE2b-256 84407f957e4c185904e68a5aed9d235a662411600c9cf4c855d21f05318534dd

See more details on using hashes here.

File details

Details for the file cascade_lattice-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cascade_lattice-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82e073d93b0aa4b1a485ecc51c4cc67602976e857ed992e3dc9f8dbfbcf82ec2
MD5 381d033362cec09dcb5cbf966a9eae33
BLAKE2b-256 8910263c64f1caa95ee8ff9af1a6a93b205750a1388213a5dea03124109cb7e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page