Metadata-Version: 2.4
Name: ct-toolkit
Version: 0.2.9
Summary: Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems
Author: Hakan Damar
License: Apache-2.0
Keywords: llm,ai-safety,identity-continuity,guardrails,alignment
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: instructor>=1.3.0
Requires-Dist: any-llm-sdk[all]>=1.0.0
Requires-Dist: numpy>=1.26.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: pydantic>=2.5.0
Requires-Dist: cryptography>=42.0.0
Requires-Dist: SQLAlchemy>=2.0.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: rich>=13.0.0
Requires-Dist: jinja2>=3.1.0
Provides-Extra: ollama
Requires-Dist: ollama>=0.2.0; extra == "ollama"
Provides-Extra: langchain
Requires-Dist: langchain-core>=1.2.0; extra == "langchain"
Provides-Extra: crewai
Requires-Dist: crewai>=1.10.0; extra == "crewai"
Provides-Extra: autogen
Requires-Dist: pyautogen>=0.4.0; extra == "autogen"
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
Provides-Extra: ml
Requires-Dist: torch>=2.0.0; extra == "ml"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Dynamic: license-file

# Computational Theseus Toolkit (CT Toolkit)

> **Identity Continuity Guardrails for Agentic Systems**

[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
[![PyPI version](https://img.shields.io/pypi/v/ct-toolkit.svg)](https://pypi.org/project/ct-toolkit/)
[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://hakandamar.github.io/ct-toolkit/)

CT Toolkit is an open-source security layer designed to preserve the **identity continuity** of AI agents over time. It implements the **Nested Agency 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/**](https://hakandamar.github.io/ct-toolkit/)

- [**Live Examples & Case Studies**](https://hakandamar.github.io/ct-toolkit/examples/): Real-world scenarios like Financial Auditor Integrity.

---

## 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.

- **Constitutional Kernels**: Axiomatic identity anchors.
- **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

```bash
pip install ct-toolkit
```

```python
from ct_toolkit import TheseusWrapper

# One-line injection for any LLM provider
client = TheseusWrapper(provider="openai")

# 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}")
```

---

## 🚦 Project Health & Status

| Metric | Status |
| :--- | :--- |
| **Tests** | ✅ 218/218 passing (93% coverage) |
| **Last Phase** | ✅ Phase 4: OS Support, Deep Agents & Alerts (Complete) |
| **Current Goal** | 🔶 Phase 5: Vault and Security Infrastructure |

For a detailed breakdown of the 8-phase roadmap, see [**PROJECT_STATUS.md**](docs/PROJECT_STATUS.md).

### 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)**](https://hakandamar.com/the-computational-theseus-engineering-identity-continuity-as-a-guardrail-against-sequential-963918c1720d) into engineering practice.

---

## License
Apache License 2.0.
