Computational Theseus Toolkit¶
Identity Continuity & Hierarchical Guardrails for the Post-Drift AI Era.
CT Toolkit is an open-source security layer that prevents Sequential Self-Compression (SSC) in agentic systems — ensuring your AI agents remain who they were on day one, even after thousands of interactions.
Get Started with Python View on GitHub
Two lines of code. Full identity protection.¶
# Before
# response = openai.OpenAI().chat.completions.create(...)
# After — sync (`chat`), async (`achat`), and streaming (`stream=True`) guardrails
client = TheseusWrapper(provider="openai")
response = client.chat("What are your core values?")
print(f"Divergence Score: {response.divergence_score:.4f}") # 0.0 = aligned, 1.0 = drifted
Audit & Telemetry Dashboard (CLI & Web UI)¶
Inspect HMAC provenance chain integrity, L1/L2/L3 divergence tier distribution, and staged sandbox rules in your terminal (ct-toolkit status) or via the local interactive Web Audit Dashboard (ct-toolkit dashboard --web):

Why CT Toolkit?¶
-
Constitutional Kernels
Define immutable Axiomatic Anchors that never change, and Plastic Commitments that evolve through formal approval.
-
3-Tier Contrastive Divergence Engine
Layered monitoring from contrastive L1 embeddings (positive + negative anchors) to non-blocking background L3 identity probes with automatic circuit breaking.
-
Hierarchical & Distributed Safety
Mother agent constraints propagate to sub-agents in-process or via HMAC-SHA256 signed HTTP headers as read-only axioms.
-
Cryptographic Provenance & OTel
Every interaction is signed with HMAC-SHA256 and chained in SQLite or PostgreSQL, paired with OpenTelemetry spans and metrics.
-
Framework Middleware
Drop-in support for LangChain, Deep Agents, CrewAI, and AutoGen. Add identity protection to your existing agent stack without rewriting a single chain.
-
CLI & Interactive Web Dashboard
Monitor provenance chains, divergence tiers, and sandbox cooldowns via Rich CLI or the localhost-bound Web Audit Dashboard.
Existing guardrails aren't enough¶
| Llama-Guard / Rule Engines | CT Toolkit | |
|---|---|---|
| Stateful drift detection | ✗ Stateless per-prompt | ✓ Tracks identity over thousands of calls |
| Multi-agent hierarchies | ✗ No hierarchy awareness | ✓ Propagates kernel constraints to sub-agents |
| Formal rule evolution | ✗ Binary block/allow | ✓ Reflective Endorsement with signed approval |
| Cryptographic audit trail | ✗ No provenance | ✓ HMAC hash chain, regulator-ready |
| Fine-tuning safety | ✗ No training constraints | ✓ DivergencePenaltyLoss for PyTorch |
Project status¶
| Metric | Status |
|---|---|
| Version | ✅ v0.4.1 |
| Tests | ✅ 426 passed, 3 skipped |
| Coverage | ✅ 90%+ |
| PyPI | ✅ pip install ct-toolkit |
| Downloads | |
| License | Apache 2.0 |
| Python | 3.11+ |