Skip to main content

Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems

Project description

Computational Theseus Toolkit (CT Toolkit)

Identity Continuity Guardrails for Agentic Systems

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

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

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.


🚦 Project Health & Status

Metric Status
Tests ✅ 330 passed, 0 failed (100% success rate, 93% coverage)
Downloads PyPI Downloads
Last Phase ✅ v0.3.20: Capability registry + role/environment policy metadata standardized across middleware
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.

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

ct_toolkit-0.3.20.tar.gz (80.7 kB view details)

Uploaded Source

Built Distribution

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

ct_toolkit-0.3.20-py3-none-any.whl (89.7 kB view details)

Uploaded Python 3

File details

Details for the file ct_toolkit-0.3.20.tar.gz.

File metadata

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

File hashes

Hashes for ct_toolkit-0.3.20.tar.gz
Algorithm Hash digest
SHA256 766ed282aa38efc920f66c54beda95c5d54464d2ff71920d962acafae320a0d4
MD5 fce9eca3b37256a3a7571a23fa3d684d
BLAKE2b-256 88e59e58f0d54e381934f6a20d8e81c0518ac8c1f1b4a0d358fa313c0eefeaa0

See more details on using hashes here.

File details

Details for the file ct_toolkit-0.3.20-py3-none-any.whl.

File metadata

  • Download URL: ct_toolkit-0.3.20-py3-none-any.whl
  • Upload date:
  • Size: 89.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ct_toolkit-0.3.20-py3-none-any.whl
Algorithm Hash digest
SHA256 02247bf819c05a475b4c323b20a97f5832578079537d17f07dbdcc760660b904
MD5 8c0df9bffbf24e91036c8596ed738040
BLAKE2b-256 ec617fe8caa11c100519f0b63c3b7068b153a865b84bd2789fef59d3f5cf1056

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