Skip to main content

Computational Theseus Toolkit (CT Toolkit)

Identity Continuity Guardrails for Agentic Systems

Python 3.11+ License: Apache 2.0 PyPI version Documentation PyPI Downloads codecov

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.


📖 Official Documentation

For full API reference, architecture details, examples, and integration guides, visit our documentation site: 👉 https://hakandamar.github.io/ct-toolkit/


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.

  • 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: Axiomatic identity anchors.
  • Standalone Auditor CLI: Rapidly audit any LLM endpoint for identity drift without writing code.
  • Autonomous Self-Correction: Active L2->L1 feedback loop that retries and corrects divergent responses before they reach the user.
  • Divergence Engine: Multi-tiered drift analysis (L1/L2/L3).
  • Hierarchical Propagation: Mother-to-child constraint inheritance.
  • Provenance Log: Immutable HMAC-signed interaction history.

Quick Start

pip install ct-toolkit
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)

# Guardrails and drift analysis applied automatically
response = client.chat("What are your core security axioms?")

print(response.content)
print(f"Divergence Score: {response.divergence_score}")

🔍 Standalone Auditor (CLI)

Audit any LLM endpoint (OpenAI, Ollama, LM Studio) directly from your terminal:

# 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 ✅ 397 passed, 3 skipped (100% success rate, 90% coverage)
Downloads PyPI Downloads
Last Phase ✅ v0.3.39: urllib3 >=2.8.0 and LiteLLM >=1.104.0 fix Chunked Deflate infinite loop and authenticated SSRF / provider-credential exfiltration (Dependabot #69/#70)
Current Goal 🔶 Phase 7: Multi-Agent Synchronization (Integration)

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_reply hooks.

Theoretical Foundation

Translating the framework proposed in The Computational Theseus (2025) into engineering practice.


Community


License

Apache License 2.0.

Metadata

Release files for ct-toolkit 0.3.39

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ct-toolkit 0.3.39
File Size Uploaded Provenance
ct_toolkit-0.3.39.tar.gz 99.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ct-toolkit 0.3.39
File Interpreter ABI Platform
ct_toolkit-0.3.39-py3-none-any.whl Python 3 none any Details

Total release size: 208.1 kB

Release files / ct_toolkit-0.3.39.tar.gz

Download URL ct_toolkit-0.3.39.tar.gz
Size 99.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7fcba51458b7eaa54affc73bd5276a44ade048cb9adc374a3f809e6ac8934ac7
BLAKE2b-256 checksum
How to use checksums
29dc23c161138bfde421fbb1a401b35923355719be7a59014942e001d9adc9a2
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.3.39-py3-none-any.whl

Download URL ct_toolkit-0.3.39-py3-none-any.whl
Size 109.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec736fbad501e970a1b50e3ef88b676239276156e21659ac84a09f4089dfee88
BLAKE2b-256 checksum
How to use checksums
12cab9d24011641d4fc405e890d53e810a6134455f60778142f17c870c44340b
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.3.39

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.

Release history Release notifications | RSS feed

This release

0.3.39 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page