OPEN SOURCE — MIT LICENSE

AI permissions that
only shrink.

Once an AI agent reads sensitive data, its write and execute permissions are permanently removed. No API call, no override, no rollback can restore them.

P(t) ⊆ P(t-1) for all t — mathematically guaranteed

The Problem

AI agents with broad permissions can silently exfiltrate sensitive data. RBAC grants permissions at session start and never reduces them based on what the agent actually accessed.

Without Ratchet

Agent starts
Scopes: read:*, write:*, delete:*, execute:*
Read HR database
SELECT * FROM employees WHERE salary > 100000
Write to Slack
POST /api/chat.postMessage { channel: "#general", text: "Top earners: ..." }
Data exfiltrated
Confidential salary data leaked to public channel

With Sensitivity Ratchet

Agent starts
Scopes: read:*, write:*, delete:*, execute:*
Read HR database
CONFIDENTIAL access → ratchet narrows to {read:*, write:*}
Read medical records
RESTRICTED access → ratchet narrows to {read:*}
Write to Slack
BLOCKED — write:* was irreversibly removed

Interactive Demo

Click the buttons below to simulate an AI agent accessing data at different sensitivity levels. Watch the permissions shrink — and try to restore them.

Agent Permissions

High-Water Mark:PUBLIC
👁
READ
✏️
WRITE
🗑
DELETE
EXECUTE
HW(t): 0 ≥ HW(t-1)|P(t)|: 4 ⊆ P(t-1)Irreversible: true

Simulate Agent Actions

How It Works

📐

Two Invariants

High-water mark only increases. Permission set only shrinks. These hold for every operation, no exceptions.

🔧

Structural Enforcement

Not a policy check. Not a prompt instruction. The narrowing is implemented in code that cannot be bypassed at runtime.

🔗

Delegation Safe

Child agents inherit the parent's ratchet state. A sub-agent spawned after CONFIDENTIAL access cannot obtain delete permissions.

// Narrowing rules
PUBLICNo change
INTERNALNo change
CONFIDENTIALdeleteexecuteremoved
RESTRICTED+writedeleteexecuteremoved

Get Started in 30 Seconds

pip install agent-iam-ratchet
from agent_iam_ratchet import RatchetSession, Sensitivity

session = RatchetSession(scopes=["read:*", "write:*", "delete:*", "execute:*"])

# Agent reads a confidential document
session.access(Sensitivity.CONFIDENTIAL)
print(session.effective_scopes)
# frozenset({'read:*', 'write:*'})  ← delete + execute gone forever

# Agent reads restricted data
session.access(Sensitivity.RESTRICTED)
print(session.effective_scopes)
# frozenset({'read:*'})  ← write gone forever

# Try to get permissions back by reading public data
session.access(Sensitivity.PUBLIC)
print(session.effective_scopes)
# frozenset({'read:*'})  ← still read-only. Irreversible.

Framework Integrations

LangChain

pip install 'agent-iam-ratchet[langchain]'

CrewAI

pip install 'agent-iam-ratchet[crewai]'

OpenAI Agents SDK

pip install 'agent-iam-ratchet[openai-agents]'

Stop sensitivity mixing attacks.

One line of code. Zero configuration. Mathematically irreversible.