Metadata-Version: 2.4
Name: cognoxium
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Typing :: Typed
Requires-Dist: pyarrow>=25.0.0 ; extra == 'arrow'
Requires-Dist: pytz>=2026.3.post1 ; extra == 'arrow'
Requires-Dist: pyarrow>=25.0.0 ; extra == 'dev'
Requires-Dist: pytz>=2026.3.post1 ; extra == 'dev'
Requires-Dist: pandas>=3.0.5 ; python_full_version >= '3.11' and extra == 'dev'
Requires-Dist: pandas>=2,<3 ; python_full_version < '3.11' and extra == 'dev'
Requires-Dist: polars>=1.43.2 ; extra == 'dev'
Requires-Dist: tiktoken>=0.13.0 ; extra == 'dev'
Requires-Dist: tokenizers>=0.23.1 ; extra == 'dev'
Requires-Dist: pytest>=9.1.1 ; extra == 'dev'
Requires-Dist: hypothesis>=6.165.0 ; extra == 'dev'
Requires-Dist: mypy>=2.3.0 ; extra == 'dev'
Requires-Dist: ruff>=0.16.1 ; extra == 'dev'
Requires-Dist: sphinx>=9.1.0 ; python_full_version >= '3.12' and extra == 'dev'
Requires-Dist: sphinx>=8,<9 ; python_full_version < '3.12' and extra == 'dev'
Requires-Dist: myst-parser>=5.1.0 ; python_full_version >= '3.11' and extra == 'dev'
Requires-Dist: myst-parser>=4,<5 ; python_full_version < '3.11' and extra == 'dev'
Requires-Dist: sphinx-intl>=2.3.2 ; extra == 'dev'
Requires-Dist: furo>=2025.12.19 ; extra == 'dev'
Requires-Dist: sphinx>=9.1.0 ; python_full_version >= '3.12' and extra == 'docs'
Requires-Dist: sphinx>=8,<9 ; python_full_version < '3.12' and extra == 'docs'
Requires-Dist: myst-parser>=5.1.0 ; python_full_version >= '3.11' and extra == 'docs'
Requires-Dist: myst-parser>=4,<5 ; python_full_version < '3.11' and extra == 'docs'
Requires-Dist: sphinx-intl>=2.3.2 ; extra == 'docs'
Requires-Dist: furo>=2025.12.19 ; extra == 'docs'
Requires-Dist: pandas>=3.0.5 ; python_full_version >= '3.11' and extra == 'pandas'
Requires-Dist: pandas>=2,<3 ; python_full_version < '3.11' and extra == 'pandas'
Requires-Dist: polars>=1.43.2 ; extra == 'polars'
Requires-Dist: pytest>=9.1.1 ; extra == 'test'
Requires-Dist: hypothesis>=6.165.0 ; extra == 'test'
Requires-Dist: mypy>=2.3.0 ; extra == 'test'
Requires-Dist: ruff>=0.16.1 ; extra == 'test'
Requires-Dist: tiktoken>=0.13.0 ; extra == 'tokenizers'
Requires-Dist: tokenizers>=0.23.1 ; extra == 'tokenizers'
Provides-Extra: arrow
Provides-Extra: dev
Provides-Extra: docs
Provides-Extra: pandas
Provides-Extra: polars
Provides-Extra: test
Provides-Extra: tokenizers
License-File: LICENSE
Summary: A trustworthy context DataFrame for AI applications, powered by Rust.
Keywords: ai,llm,context,dataframe,rust,security
Author: Cognoxium contributors
License-Expression: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://nue-japan.github.io/cognoxium/en/latest/
Project-URL: Issues, https://github.com/Nue-Japan/cognoxium/issues
Project-URL: Repository, https://github.com/Nue-Japan/cognoxium

# Cognoxium

[日本語](README.ja.md) · [Documentation](https://nue-japan.github.io/cognoxium/en/latest/) · [Security](SECURITY.md)

**Cognoxium is a trustworthy context DataFrame for AI applications, powered by Rust.**

AI applications ingest messages, retrieved documents, tool results, and external resources from trust domains that do not naturally fit into a single safe prompt. Cognoxium treats those inputs as typed data with provenance, sensitivity, retention, token cost, and lineage—then compiles them into a deterministic, auditable context pack.

> Project status: **alpha**. The Python API is usable today and automatically selects the Rust extension when installed. Serialization compatibility is not guaranteed before 1.0.

## Install

```bash
pip install cognoxium
```

Optional interoperability dependencies are separate:

```bash
pip install "cognoxium[arrow,pandas,polars,tokenizers]"
```

## Quickstart

```python
import cognoxium as cx

records = [
    {"id": "policy", "payload": "Never disclose credentials.", "role": "system",
     "sources": ["app://policy"], "trust": "trusted", "retention": "required"},
    {"id": "result", "payload": "The build passed.", "sources": ["tool://ci"]},
]
pack = (
    cx.CognitionFrame.from_records(records).dedupe().rank("build status")
    .pack(budget=512, token_profile=cx.profiles.approximate(),
          boundary=cx.Boundary.external("openai"))
)
print(pack.to_openai())
```

## Why Cognoxium?

- **DataFrame ergonomics:** lazy filtering, projection, joins, grouping, ranking, and deterministic deduplication.
- **Budget-aware packing:** required, preferred, and optional retention contracts with explicit overflow behavior.
- **Trust boundaries:** provenance, quarantine, sensitivity labels, expiry, and secret-aware external packing.
- **Auditable lineage:** every exclusion, merge, truncation, and token decision is captured in a manifest.
- **Provider-neutral output:** render the same pack for OpenAI, Anthropic, or plain text.
- **Local by default:** no network calls, API keys, model calls, accounts, or telemetry in the core library.

## Security model

Cognoxium enforces deterministic information-flow rules. It does **not** claim to solve prompt injection or determine whether arbitrary content is truthful. Injection detection is a risk signal; trust labels, provenance, least privilege, and application-side authorization remain necessary.

## Development

```bash
python -m unittest discover -s tests -v
cargo test --workspace
```

Build the extension with [maturin](https://www.maturin.rs/):

```bash
maturin develop
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow.

## License

Licensed under the [Apache License 2.0](LICENSE).

