Metadata-Version: 2.4
Name: context-fission
Version: 1.0.0
Summary: Context portfolio optimizer for LLMs with compression, convergence loops, validation gates, and wave scheduling.
Project-URL: Homepage, https://github.com/rotsl/ContextFission
Project-URL: Repository, https://github.com/rotsl/ContextFission
Project-URL: Documentation, https://github.com/rotsl/ContextFission/tree/main/docs
Project-URL: Issues, https://github.com/rotsl/ContextFission/issues
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: compression,context,llm,optimization,rag
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: numpy>=1.26
Requires-Dist: pydantic>=2.7
Requires-Dist: pyyaml>=6.0.1
Requires-Dist: rich>=13.7
Requires-Dist: tiktoken>=0.7
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: mkdocs-material; extra == 'dev'
Requires-Dist: mkdocstrings[python]; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Provides-Extra: local-models
Requires-Dist: huggingface-hub>=0.23; extra == 'local-models'
Requires-Dist: torch>=2.2; (python_version < '3.14') and extra == 'local-models'
Requires-Dist: transformers>=4.40; extra == 'local-models'
Description-Content-Type: text/markdown

# ContextFission (PyPI)

ContextFission is a context compiler for LLM workflows.
It ingests source context, retrieves and scores blocks, selects under token budget, applies attention-based fusion, and assembles provider-ready packets.

## Install

Base package:

```bash
pip install context-fission
```

With local decoder support (model download + transformers stack):

```bash
pip install "context-fission[local-models]"
```

Notes:

- `torch` wheels are available for Python <= 3.13 on most platforms.
- On Python 3.14, install local-model dependencies manually once wheels are available.

## CLI

Show version:

```bash
context-fission version
```

Compress text file:

```bash
context-fission compress input.md --intensity medium
```

Validate compression:

```bash
context-fission validate original.md compressed.md
```

Run pipeline:

```bash
context-fission pipeline ./data --query "incident response" --budget 4096
```

Run web UI:

```bash
context-fission ui --host 127.0.0.1 --port 8080
```

Download local model:

```bash
context-fission download-model google/flan-t5-base
context-fission download-model Qwen/Qwen2.5-0.5B-Instruct --ignore-patterns "flax*,tf_*"
```

## Local Decoder Runtime

Set model and mode:

```bash
export CONTEXTFISSION_LOCAL_DECODER_MODEL=Qwen/Qwen2.5-0.5B-Instruct
export CONTEXTFISSION_CAVEMAN_IO=true
```

Then use Python API or provider-backed pipeline paths.

## Python API Example

```python
from context_fission.orchestration.runner import PipelineRunner

runner = PipelineRunner(token_budget=3000)
result = runner.run("./docs/notes.md", query="auth flow", mode="compact", compress=True)

print(result["selected_blocks"])
print(result["total_tokens"])
```
