Metadata-Version: 2.4
Name: statebits
Version: 0.1.1
Summary: A causal computing framework for transparent and explainable state management
Home-page: https://statebits.xyz
Author: Semon Khan
Author-email: semon.2444@gmail.com
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.0.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: flake8>=5.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Provides-Extra: visualization
Requires-Dist: matplotlib>=3.5.0; extra == "visualization"
Requires-Dist: networkx>=2.8.0; extra == "visualization"
Requires-Dist: graphviz>=0.20.0; extra == "visualization"
Provides-Extra: async
Requires-Dist: asyncio>=3.4.3; extra == "async"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


# Statebits Framework

A causal computing framework for transparent and explainable state management.

## Overview

Statebits is a Python library developed by Semon Khan designed to revolutionize state management in applications by emphasizing transparency and explainability. By leveraging causal computing principles, Statebits ensures that each state transition is not only recorded but also explained in a manner that is understandable to users. This framework is particularly useful in systems where tracking the history and rationale behind state changes is essential for decision-making and auditing purposes.

## Features

- **Transparent State Management**: Track and understand state changes with ease.
- **Explainable**: Built-in tools to explain state transitions and logic, making it easier to debug and trust your applications.
- **Modular Design**: Easily extend and customize the framework to fit your specific needs.
- **Cross-Domain Applicability**: Suitable for a wide range of applications, from AI and finance to healthcare and IoT.

## Detailed Usage Guide

### Initializing the State Manager

First, import the `StateManager` class from the `statebits` module and initialize it.

```python
from statebits import StateManager

# Initialize the State Manager
state_manager = StateManager()
```

### Setting an Initial State

Define and set an initial state for your application.

```python
initial_state = {"status": "initializing"}
state_manager.set_state(initial_state)
```

### Updating the State

Update the state as your application evolves.

```python
new_state = {"status": "running"}
state_manager.update_state(new_state)
```

### Retrieving the Current State

Retrieve the current state to make decisions based on the latest information.

```python
current_state = state_manager.get_state()
print(current_state)
```

### Explaining State Transitions

Use the built-in tools to explain state transitions and understand the rationale behind each change.

```python
explanation = state_manager.explain_transition(from_state=initial_state, to_state=new_state)
print(explanation)
```

### Advanced Usage

#### Custom State Validators

Implement custom state validators to ensure that state transitions adhere to specific rules.

```python
def validate_state(state):
    if "status" not in state:
        raise ValueError("State must contain a 'status' field")
    return True

state_manager.set_validator(validate_state)
```

#### State History and Auditing

Access the complete history of state changes for auditing and analysis.

```python
history = state_manager.get_history()
for change in history:
    print(change)
```

## Applications

### AI

- **Explainable AI (XAI)**: Enhance transparency in AI models, crucial for trust in high-stakes areas like healthcare and autonomous vehicles.
- **Debugging and Development**: Track the state of AI models during training and inference for easier issue identification and resolution.

### Finance

- **Audit Trails**: Maintain transparent and auditable records of transactions and state changes for compliance and fraud detection.
- **Risk Management**: Understand factors leading to certain risks and make informed decisions with clear explanations of state changes.

### Crypto

- **Smart Contracts**: Improve transparency and explainability of smart contracts on blockchain platforms.
- **Decentralized Finance (DeFi)**: Track and understand state changes in complex financial instruments, improving trust and adoption.

### Health

- **Patient Data Management**: Ensure transparency and explainability in patient data management, improving patient care and compliance with regulations.
- **Clinical Decision Support**: Assist healthcare professionals in making informed decisions based on patient data with clear explanations of state changes.

### Other Fields

- **Supply Chain Management**: Provide transparency in supply chain operations, tracking the state of goods and understanding factors affecting performance.
- **IoT Systems**: Manage the state of connected devices in IoT applications, improving system reliability with clear explanations of state changes.

## Changing Computation Forever

Statebits represents a paradigm shift in how we approach state management and computation. By providing a framework that emphasizes transparency and explainability, Statebits addresses critical challenges in modern computing:

- **Trust and Accountability**: Enhance trust in computational systems by providing clear explanations of state changes, making it easier to hold systems accountable.
- **Debugging and Maintenance**: Simplify the debugging and maintenance of complex systems by offering detailed insights into state transitions.
- **Collaboration and Integration**: Facilitate collaboration and integration between different systems and domains by providing a common framework for state management.

## License

Statebits is released under the MIT License. See the LICENSE file for more details.

