Computational Theseus Toolkit (CT Toolkit)
Identity Continuity Guardrails for Agentic Systems
CT Toolkit is an open-source security layer designed to preserve the identity continuity of AI agents over time. It implements the Nested Agentic Architecture (NAA) framework to prevent Sequential Self-Compression (SSC) in multi-agent hierarchies.
$ ct-toolkit status
_______ _ _ ______ _____ ______ _ _ _____ _____ _ _ _____ _____
|__ __| | | | ____|/ ____| ____| | | |/ ____| / ____| | | | /\ | __ \| __ \
| | | |__| | |__ | (___ | |__ | | | | (___ | | __| | | | / \ | |__) | | | |
| | | __ | __| \___ \| __| | | | |\___ \ | | |_ | | | | / /\ \ | _ /| | | |
| | | | | | |____ ____) | |____| |__| |____) | | |__| | |__| |/ ____ \| | \ \| |__| |
|_| |_| |_|______|_____/|______|_____/|_____/ \_____|\____//_/ \_\_| \_\_____/
Computational Theseus Toolkit (CT Toolkit) v0.4.1
Identity Continuity Guardrails for Agentic Systems
╭──────────────────── CT Toolkit Audit & Telemetry Status ─────────────────────╮
│ Vault: ./ct_provenance.db (local) │
│ Chain Integrity: VALID (HMAC Verified) │
│ Verified Active Entries: 4 (showing last 4) │
│ Divergence Score (Avg / Max): 0.1525 / 0.3800 │
│ Head Hash: 9c64cb51a479c52c207b7fa8c3197a75... │
╰──────────────────────────────────────────────────────────────────────────────╯
Divergence Tier Breakdown (L1 / L2 / L3)
┏━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┓
┃ Tier ┃ Count ┃ Share ┃
┡━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━┩
│ OK │ 1 │ 33.3% │
│ L1_WARNING │ 1 │ 33.3% │
│ L2_JUDGE │ 1 │ 33.3% │
│ L3_ICM │ 0 │ 0.0% │
└────────────┴───────┴───────┘
Staged Kernel Rules (Sandbox Cooldown)
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Endorsement ID ┃ Commitment ┃ Rule Text ┃ Status ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ end-9f8a7b6c │ fin_integrity_01 │ Require dual │ ACTIVE COOLDOWN │
│ │ │ sign-off for │ (1799s left) │
│ │ │ adjustments > $10k │ │
└────────────────┴──────────────────┴────────────────────┴─────────────────────┘
📖 Official Documentation
For full API reference, architecture details, examples, and integration guides, visit our documentation site: 👉 https://theseus-guard.github.io/ct-toolkit/
- Live Examples & Case Studies: Real-world scenarios like Financial Auditor Integrity.
- FastAPI Integration Test Project: Reference FastAPI app for validating CT Toolkit end-to-end across L1/L2/L3 guardrails and provenance logs with local model infrastructure.
- Deep Agents Integration Test Project: Reference Deep Agents app for validating CT Toolkit end-to-end with hierarchical agent workflows, L1/L2/L3 guardrails, and provenance logs.
Why CT Toolkit?
In complex agentic workflows, LLMs tend to "drift" from their original instructions. CT Toolkit provides the mathematical and cryptographic guardrails to ensure your agents remain aligned with their core constitution, even across deep hierarchies.
- Async & Streaming Guardrails (
achat): Nativeasync/awaitand streaming (stream=True) support with non-blocking background execution for shadow requests and L3 ICM probes. - Contrastive Semantic L1 Engine: Provider-independent embeddings (
litellm,ollama, localfastembed) with positive/negative anchor analysis and semantic rule conflict detection. - Staged Approval (Cooldown): Verify risky kernel updates in a sandbox via shadow requests before production promotion.
- Passive Context Compression Detection: Automatically detects silent provider-side history compression (e.g., OpenAI/Anthropic).
- Constitutional Kernels & Distributed Propagation: Axiomatic identity anchors with HMAC-SHA256 signed HTTP header propagation (
propagate_headers/from_headers). - Standalone Auditor & Status CLI: Rapidly audit any LLM endpoint (
ct-toolkit audit) and inspect provenance integrity & divergence tiers (ct-toolkit status/dashboard). - Autonomous Self-Correction: Active L2->L1 feedback loop that retries and corrects divergent responses before they reach the user.
- Enterprise Provenance & Observability: Immutable HMAC-signed hash chain supporting SQLite and PostgreSQL/SQLAlchemy with paginated verification and OpenTelemetry (OTel) spans/metrics.
Quick Start
# Core lightweight install
pip install ct-toolkit
# Or install with optional extras (cli, server, enterprise, embeddings, observability, all)
pip install "ct-toolkit[all]"
from ct_toolkit import TheseusWrapper, WrapperConfig
# Protect against silent provider context compression
config = WrapperConfig(compression_passive_detection=True)
# One-line injection for any LLM provider
client = TheseusWrapper(provider="openai", config=config)
# Sync or async (`await client.achat(...)`) with automatic drift analysis
response = client.chat("What are your core security axioms?")
print(response.content)
print(f"Divergence Score: {response.divergence_score}")
🔍 Standalone Auditor & Dashboard (CLI & Web UI)
Audit any LLM endpoint (OpenAI, Ollama, LM Studio) and inspect your provenance chain directly from your terminal or in the interactive Web Audit Dashboard:
# View Provenance Chain integrity, L1/L2/L3 tier breakdown, and staged rules in terminal
ct-toolkit status --vault ./ct_provenance.db
# Launch the interactive Web Audit & Telemetry Dashboard at http://127.0.0.1:8001/dashboard
ct-toolkit dashboard --web --vault ./ct_provenance.db --port 8001
# Audit a local Ollama model
ct-toolkit audit --url http://localhost:11434/v1 --kernel defense
# List available kernels and templates
ct-toolkit list-kernels
ct-toolkit list-templates
# Download a verified profile from the official repository
ct-toolkit setup personal_kernel --dest ./config
If you want a runnable application example instead of a CLI-only flow, see ct-toolkit-fastapi, a small FastAPI validation project that developers can use to test CT Toolkit locally with automated endpoints and pytest coverage.
For Deep Agents workflows, see ct-toolkit-deep-agents, a reference integration project for validating CT Toolkit in multi-agent orchestration scenarios.
Security Hardening
The profile setup command fails closed by default. Downloaded kernel, identity, and probe files must match the trusted SHA-256 manifest packaged with CT Toolkit before they are written to disk. HTTPS certificate validation is enabled and redirects to another host or scheme are rejected.
The L2 judge does not evaluate Jinja2 expressions in user requests or model responses. Rule validation normalizes Unicode input and requires configured conflict keywords to match complete words, preventing simple substring and keyword-boundary bypasses.
🚦 Project Health & Status
| Metric | Status |
|---|---|
| Tests | ✅ 426 passed, 3 skipped (100% success rate, 90%+ coverage) |
| Downloads | |
| Last Phase | ✅ v0.4.1: aiohttp 3.14.5 DoS/header-timeout/cookie-Secure fixes (Dependabot #74-76) |
Framework & Model Support
Seamlessly integrate with your favorite frameworks and local models:
- Local Models: Support for LM Studio, Ollama, and local Qwen/Llama endpoints.
- LangChain & Deep Agents:
wrap_deep_agent_factory. - CrewAI:
TheseusCrewMiddleware.apply_to_crew. - AutoGen:
register_replyhooks.
Theoretical Foundation
Translating the framework proposed in The Computational Theseus (2025) into engineering practice.
Community
- Contributing Guide: How to propose changes, run tests, and submit pull requests.
- Security Policy: How to report vulnerabilities responsibly.
- Code of Conduct: Expected behavior for contributors and maintainers.
- Support Guide: Where to ask questions, report bugs, and request features.
License
Apache License 2.0.
Metadata
Release files for ct-toolkit 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ct_toolkit-0.4.1.tar.gz | 138.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ct_toolkit-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 274.1 kB
Release files / ct_toolkit-0.4.1.tar.gz
| Download URL | ct_toolkit-0.4.1.tar.gz |
|---|---|
| Size | 138.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a67881cf3f10986ce4f8d458b6f87cae24dfca97f363675d5b28bbf83f01dc8
|
|
BLAKE2b-256 checksum How to use checksums |
fd74c1efeb9d5cbe9de5d93256ad14004333e1c979b3560a53487fb8448aeb85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ct_toolkit-0.4.1-py3-none-any.whl
| Download URL | ct_toolkit-0.4.1-py3-none-any.whl |
|---|---|
| Size | 135.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b79a579b3b78c1ef4c03dc67ed8a768faf3ed7544d86bbf0db116712c705b44e
|
|
BLAKE2b-256 checksum How to use checksums |
f55e19c14db57eaed744b78ed2af8a6bceaabb4106d19dc7f563bff1adbedb7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for ct-toolkit 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.