Metadata-Version: 2.4
Name: cowrie-ai
Version: 1.3.1
Summary: 16 KB-aligned content-addressed AI container, Profile E/C verified KV StatePages (vLLM V4 / llama.cpp), S3 semantic capsules, Capability V2, tiered Autonomy Leases (COWRIE_LEASE_V1), and offline verify-bundle runtime.
Author-email: Femi Adeniran <hello@omenworks.dev>
License-Expression: Apache-2.0
Project-URL: Homepage, https://omenworks.dev/
Project-URL: Repository, https://github.com/Neumenon/cowrie
Project-URL: Documentation, https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/QUICKSTART.md
Project-URL: Changelog, https://github.com/Neumenon/cowrie/blob/v1.3.1/CHANGELOG.md
Keywords: ai,mcp,vllm,kv-cache,llm,agents,langgraph,pydantic-ai,security,merkle,ed25519,autonomy-leases
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: vllm
Requires-Dist: torch>=2.2; extra == "vllm"
Requires-Dist: vllm>=0.15.0; extra == "vllm"
Provides-Extra: langgraph
Requires-Dist: langgraph>=0.2; extra == "langgraph"
Provides-Extra: pydantic-ai
Requires-Dist: pydantic-ai>=0.1; extra == "pydantic-ai"
Provides-Extra: openai-agents
Requires-Dist: openai-agents>=0.0.10; extra == "openai-agents"
Provides-Extra: diffusers
Requires-Dist: torch>=2.2; extra == "diffusers"
Requires-Dist: diffusers>=0.30; extra == "diffusers"
Provides-Extra: lancedb
Requires-Dist: lancedb>=0.15; extra == "lancedb"
Dynamic: license-file

<p align="center">
  <a href="https://omenworks.dev/">
    <img alt="Cowrie v1.3.1 — Binary infrastructure for live AI by OmenWorks" src="https://raw.githubusercontent.com/Neumenon/cowrie/v1.3.1/docs/assets/cowrie-banner-dark.svg" width="100%">
  </a>
</p>

<p align="center">
  <a href="https://omenworks.dev/"><strong>omenworks.dev</strong></a> &nbsp;&middot;&nbsp;
  <a href="https://github.com/Neumenon/cowrie/releases/tag/v1.3.1">Release v1.3.1</a> &nbsp;&middot;&nbsp;
  <a href="https://omenworks.dev/benchmarks">Benchmarks &amp; Receipts</a> &nbsp;&middot;&nbsp;
  <a href="https://github.com/Neumenon/cowrie/blob/v1.3.1/SPEC.md">Wire Spec</a> &nbsp;&middot;&nbsp;
  <a href="https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/PROFILES.md">Profiles (E/C)</a> &nbsp;&middot;&nbsp;
  <a href="https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/SECURITY.md">Security Model</a> &nbsp;&middot;&nbsp;
  <a href="https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/AUTONOMY-LEASES.md">Autonomy Leases</a> &nbsp;&middot;&nbsp;
  <a href="https://github.com/Neumenon/cowrie/blob/v1.3.1/RETRACTION.md">Claim Corrections</a>
</p>

---

# Cowrie (`v1.3.1`)

**16 KB-aligned content-addressed binary container, verified KV StatePages (vLLM V4 / `llama.cpp`), `S3` semantic capsules, Capability V2 provenance runtime, Autonomy Leases (`COWRIE_LEASE_V1`), and offline `cowrie verify-bundle` auditor — one zero-dependency Rust/WASM core split cleanly into Edge (`Profile E`) and Cloud (`Profile C`).**

> **Package & publish note:** **`cowrie-ai==1.3.1` is published on PyPI** (Apache-2.0, sdist + `manylinux_2_39_x86_64` wheel; older Linux glibc, `aarch64`, macOS, and Windows install cleanly from the sdist with Rust `cargo` installed) and on [GitHub Releases (`v1.3.1`)](https://github.com/Neumenon/cowrie/releases/tag/v1.3.1): install with `pip install cowrie-ai==1.3.1`. The npm `cowrie-ai` package and crates.io `cowrie-core`/`cowrie-cli` are **not published** — build from source for those. Do **not** install bare `cowrie` (unrelated SSH/Telnet honeypot) or retired legacy packages (`Neumenon/cowrie-legacy` codec).

---

## Architecture at a Glance

Cowrie `v1.3.1` keeps **one shared canonical core** (`libcowrie_core`, `cowrie` CLI, `cowrie_core.wasm`) and splits runtime policies cleanly across two profiles instead of forcing one setting onto both local workstations and cloud clusters:

### Shared Core (Always On, Apache-2.0, 100% Offline-Verifiable)
- **Canonical `COWR` Wire & Dual-Tree `CWRF` Shards (`canonical.rs`, `shard.rs`):** Bijective, key-order-invariant binary frames (`169.8 ns` zero-alloc C verify on 184 B frame, Ryzen 7 7700X, [`receipt_v1_1_hardening.json`](https://github.com/Neumenon/cowrie/blob/v1.3.1/receipts/receipt_v1_1_hardening.json)), 34-byte SHA-256 multihash CIDs, and 16 KB-aligned RFC 6962 Merkle shards.
- **Canonical Prefix Splitting (`A2-Split`):** **`98.2%–100.0%`** syntactic KV prefix hit (**`85.1%–99.1%`** with volatile `request_ts` trailer split) across 5 models (`llama.cpp` + `vLLM 0.34.0`), **`0 B`** KV written, **`0`** extra turns ([`receipt_exp_b2_a2_multi_engine.json`](https://github.com/Neumenon/cowrie/blob/v1.3.1/receipts/receipt_exp_b2_a2_multi_engine.json); single-model baseline `0.2% → 85.0%` lift, `7.0–12.4×` faster prefill, `−27.6%` prompt tokens in [`receipt_exp_a3_canonical_prefix.json`](https://github.com/Neumenon/cowrie/blob/v1.3.1/receipts/receipt_exp_a3_canonical_prefix.json)).
- **Fail-Closed Verified StatePages (`CWSP`):** `verify_hash=True` always on; empty `expected_doc_cid`, empty `expected_runtime_id`, empty `expected_model_sha`, and `verify_hash=False` are rejected unconditionally at the C-ABI boundary (`ERR_INVALID_CONTRACT`). Cloud 32K (`Profile C`, Blackwell `vLLM 0.34.0` V4): 70B dense **`5.91×`** E2E (`64/64`), `GLM-4.5-Air` **`3.30×`** (`3/3` QA; `46/64` AWQ nondet, native `1/64`), `Mixtral` **`3.15×`** (`64/64`), `Qwen3.5-35B-A3B` **`1.30×`** at 32K and **fail-closed** (`MambaSpec`). Edge 32K–250K (`Profile E`, RTX 3090 `llama.cpp`): **`12.1× → 59.0×`** cold E2E-64, **`73×`** warm (`100%` parity).
- **Sticky Provenance, Capability Tokens V2 (`COWRIE_CAP_V2\0`), Autonomy Leases (`COWRIE_LEASE_V1`) & Offline Evidence (`verify-bundle`):** Out-of-band `0x80` taint surviving payloads under 16 KB, `B2-b` slices, `A2-Split`, and `S3` capsules; single-use Ed25519 capabilities bound to `(cid, action, tool, canonical_args_hash, destination, session_id, issued_at, short expiry <= 300s, nonce)` with durable `CWNL0002` nonce ledgers & `StatelessChallengeVerifier`; tiered autonomy leases (T0/T1/T2, single-use or long lease, budgets, checkpoint digest, content-addressed rollback); secret-path blocking (including symlinks); pinned MCP `tools/list` rug-pull detection (`-32025`); and **100% offline `cowrie verify-bundle`** verification of `.cwwal` chains, root-signed `TrustBundle` key lifecycles, and V2 signatures.
- **Honest security scope:** Cowrie enforces **integrity, provenance, audit, and capability binding** — it is **not** a prompt-injection firewall, host-boundary replacement, or OS sandbox. Read [`docs/SECURITY.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/SECURITY.md) and [`RETRACTION.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/RETRACTION.md).

### Two Deployment Profiles ([`docs/PROFILES.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/PROFILES.md))

| Plane / Feature | Profile E (`edge`) — Local Workstation | Profile C (`cloud`) — Single-Node Multi-Tenant Serving |
|---|---|---|
| **StatePage Durability** | `durable=True` (`fsync` on local `btrfs`/NVMe) | `durable=False` (`/dev/shm` restart/swap or dedicated local NVMe) |
| **StatePage Context Gate** | `>= 4K` tokens (`llama.cpp` / Eureka / local vLLM) | **Gated OFF `< 32K`** (`64K` recommended for dense 8B) |
| **`overlayfs` Gate** | Local persistent NVMe recommended | **Gated OFF on `overlayfs`** |
| **vLLM `MambaSpec` Hybrid** | **Fail-closed** | **Fail-closed** |
| **MCP Virtualization (`B2-b`)** | On (`16 KB` threshold, grammar-gated local loops) | **OFF on cached cloud APIs** |
| **`A2-Split` & `S3` Capsules** | Enabled (`0x80` taint preserved) | Enabled (`0x80` taint preserved) |
| **Security & `verify_hash`** | **Always ON** (durable `CWNL0002` nonce ledger) | **Always ON** (stateless challenge-nonce or Durable Object) |

### What Ships, What Is Gated, What Is Dropped
- **Ships now:** Canonical `COWR`/`CWRF` core, fail-closed verified `CWSP` StatePages (`V4` vLLM connector + `llama.cpp` + Diffusers/ComfyUI), `A2-Split`, `S3` semantic capsules, Capability Tokens V2 (`COWRIE_CAP_V2`), Autonomy Leases (`COWRIE_LEASE_V1`), Profile E/C presets, `.cwwal` audit logs, offline `cowrie verify-bundle`, and zero-import `cowrie_core.wasm` (`135.2 KiB` gzipped in `v1.3.1`, [`receipt_v1_3_wasm_and_binaries.json`](https://github.com/Neumenon/cowrie/blob/v1.3.1/receipts/receipt_v1_3_wasm_and_binaries.json)).
- **Gated (not default-on):** Cloud KV StatePages below `32K` tokens (`64K` dense 8B) and on `overlayfs`; hybrid `MambaSpec` StatePages in vLLM (fail-closed pending exact recurrent-state slot export); multi-GPU `TP >= 2` StatePage benchmarks (pending 2-GPU cloud quota).
- **Dropped:** Legacy blank-check `COWRIE_DECLASSIFY_V1` runtime authorization, in-band `_cowrie_parents` trust overrides, trusting server-claimed `readOnlyHint: true` annotations, `B2-b` virtualization against prompt-cached cloud APIs, cross-architecture raw KV adapter translation (`S1`/`S2` — replaced by `S3` semantic capsules), and "prompt-injection firewall" marketing claims.

---

## Security Audit, Fixes & Autonomy Leases (2026-11-30)

An independent three-reviewer source audit reviewed `v1.3.0` line by line against the code, not the claims. Seven external findings were triaged — **4 real, 3 partial** — and the audit surfaced additional defects the 205-attack suite had not covered.

**Fixed in `v1.3.x`:**
- **Session taint root (`COWRIE_TAINT_SET_V1`)** — one capability and one signature cover a whole multi-read tainted snapshot; the old path required one Ed25519 signature per tainted CID and deadlocked the stateless verifier.
- **Secret-path normalization** — interior quotes, backslash escapes, `file://localhost/`, allowlist `"/"`, dangling/multi-level symlinks, and `_cowrie_*` argument smuggling to child MCP servers.
- **Bounded JSON parsing and MCP framing** — 64 MiB decoded budget, 65,536-byte key cap, O(1) drain of oversized lines without desynchronising JSON-RPC.
- **Nonce ledger expiry pruning**, `_find_lib()` fail-closed ABI checks, and safe-path enforcement on `COWRIE_LIB`/`COWRIE_LIB_PATH`.
- **vLLM connector** — 3× → 1× Merkle verification per hit, TP>1/PP>1 CID parity (was a 0% hit rate), pinned-slab leak and async D2H use-after-release fixes.
- **`EvidenceBundle` integrity** — revoked keys with `revoked_at == 0`, unsigned Plane C tensors, and unescaped control characters are now refused; `lens.rs` gained a UTF-8 boundary panic fix and an O(N²) → O(N) search.

**Verified:** `tests/test_carbon_audit_regressions.py` **9/9**, security **12/12 classes / 205/205 attacks refused**, Rust **31/31**, full connector, evidence, WASM and conformance suites green. Triage and implementation notes: [`reports/CARBON-AUDIT-TRIAGE.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/reports/CARBON-AUDIT-TRIAGE.md) · [`reports/CARBON-AUDIT-SUMMARY.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/reports/CARBON-AUDIT-SUMMARY.md).

**Autonomy leases (`COWRIE_LEASE_V1`)** — bounded autonomy instead of a per-call approval modal:
- **T0** observe (free) · **T1** reversible workspace writes · **T2** shell, network, credentials, deletes, publishing (never covered by a normal lease)
- **Single-use** lease for one action, or a **long lease** bounded by time, actions, bytes, external calls and spend
- Host-pinned workspace root, symlink/`..` escape refusal, executable/config surfaces forced to T2, content-addressed snapshots with `cowrie lease rollback`, durable budgets, checkpoint digest, revocation list, and an optional high-risk T2 co-signature (≤300 s)
- CLI: `cowrie lease issue|verify|revoke|digest|rollback`; proxy flags `--lease`, `--lease-pubkey`, `--workspace-root`, `--lease-state-dir`, `--require-lease`
- Model and threat analysis: [`docs/AUTONOMY-LEASES.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/AUTONOMY-LEASES.md) · implementation report: [`reports/LEASE-IMPLEMENTATION.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/reports/LEASE-IMPLEMENTATION.md)

---

## Documentation, Formal Proofs & Receipts

- **Quickstart:** [`docs/QUICKSTART.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/QUICKSTART.md) — install `cowrie-ai==1.3.1`, CLI, Python `COWR`/`S3`/Capability V2, vLLM plugin check
- **Profiles (Edge vs Cloud):** [`docs/PROFILES.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/PROFILES.md) — exact `Profile E` & `Profile C` presets, env vars, and admission gates
- **Security Model (Honest):** [`docs/SECURITY.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/SECURITY.md) — exact guarantees, non-guarantees, and adversarial suite receipts
- **Autonomy Leases (`COWRIE_LEASE_V1`):** [`docs/AUTONOMY-LEASES.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/AUTONOMY-LEASES.md) — T0/T1/T2 risk tiers, single-use & long leases, budgets, checkpoint digest, rollback
- **Retractions & Claim Discipline:** [`RETRACTION.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/RETRACTION.md) — public falsification log and defensible replacements
- **Security Summary Receipt:** [`receipts/receipt_security_v1_3_summary.json`](https://github.com/Neumenon/cowrie/blob/v1.3.1/receipts/receipt_security_v1_3_summary.json) (`12/12` attack classes, `205/205` attacks refused; audit regressions `9/9`; Rust `31/31`)
- **Full Empirical Run Index (72 Runs + 1 Security Summary):** [`receipts/RUN-INDEX.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/receipts/RUN-INDEX.md) — RTX 3090 `32K–250K`, Blackwell `32K/64K` Big/MoE, `S3` capsules, and security receipts
- **WASM & Binary Receipt (`v1.3.1`):** [`receipts/receipt_v1_3_wasm_and_binaries.json`](https://github.com/Neumenon/cowrie/blob/v1.3.1/receipts/receipt_v1_3_wasm_and_binaries.json) — `135.2 KiB` gzipped zero-import `cowrie_core.wasm`, Node v22 timings (`0.98 ms` cold / `0.42 ms` warm median instantiate, `1.91 µs` verify+CID), native `.so` & CLI hashes
- **Formal & Differential Verification:** [`docs/laws-plain-english.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/docs/laws-plain-english.md) · [`formal/README.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/formal/README.md) (**40 Lean 4 theorems**, 26 Lean kernel mutants + 16 constructive refutations, 18 bugs `F1`–`F18` fixed in [`formal/AUDIT.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/formal/AUDIT.md)) · [`harness/PHASE2.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/harness/PHASE2.md) (**753-case differential harness** + 4 `cargo-fuzz` targets) · [`harness/FINDINGS.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/harness/FINDINGS.md)
- **Long-Form Report & Executive Summary:** [`reports/COWRIE-BOOK.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/reports/COWRIE-BOOK.md) · [`reports/FINAL-SUMMARY.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/reports/FINAL-SUMMARY.md) · [`CHANGELOG.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/CHANGELOG.md)
- **Citation & Release:** [`CITATION.cff`](https://github.com/Neumenon/cowrie/blob/v1.3.1/CITATION.cff) · [GitHub Release `v1.3.1`](https://github.com/Neumenon/cowrie/releases/tag/v1.3.1)

---

## Quick Install & Verification

```bash
pip install cowrie-ai==1.3.1
cowrie --help
python3 -c "import cowrie; print(cowrie.__version__)"
```

Release sdist and `manylinux_2_39_x86_64` wheel assets are published on [PyPI (`cowrie-ai==1.3.1`)](https://pypi.org/project/cowrie-ai/1.3.1/) and [GitHub Releases (`v1.3.1`)](https://github.com/Neumenon/cowrie/releases/tag/v1.3.1). On older Linux glibc (`< 2.39`), `aarch64`, macOS, or Windows, `pip install cowrie-ai==1.3.1` builds automatically from the sdist (requires Rust `cargo`, compiles offline in `<10 s` with zero external crates). npm `cowrie-ai` and crates.io `cowrie-core`/`cowrie-cli` are not published; build those targets from source below.

### Build From Source & Run All Test Suites
Builds default to `/tmp/cowrie-cargo-target` so the source tree stays clean:

```bash
make test                                       # Rust core release unit tests (31/31)
make conformance                                # C-ABI + 150 golden/fuzz vectors + independent Python oracle
make wasm                                       # Zero-import cowrie_core.wasm + V8 conformance
make abi-check && make adversarial              # 753-case differential harness
make connectors                                 # LangGraph, PydanticAI, OpenAI Agents, ComfyUI, Diffusers, LanceDB, Cloudflare Workers
python3 tests/test_vllm_kv_connector_unit.py    # vLLM V1/V4 connector + Profile E/C admission gates
python3 tests/test_security_v1_3_adversarial.py # Stateful multi-turn cross-restart security fuzz suite (12/12 classes, 205/205 attacks)
python3 tests/test_carbon_audit_regressions.py  # Carbon audit regression suite (9/9)
python3 tests/test_autonomy_leases.py           # Tiered Autonomy Leases (T0/T1/T2, budgets, snapshots, digest, rollback)
python3 tests/test_evidence_bundle.py           # Offline cowrie verify-bundle + TrustBundle + CAP_V2 + .cwwal replay
```

---

## Ecosystem Connectors

See [`adapters/README.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/adapters/README.md) and [`ROADMAP.md`](https://github.com/Neumenon/cowrie/blob/v1.3.1/ROADMAP.md) for integration guides covering **vLLM V1/V4 (`CowrieKVConnectorV1`)**, **`llama.cpp`**, **MCP (`cowrie mcp-proxy`)**, **LangGraph**, **PydanticAI**, **OpenAI Agents SDK**, **ComfyUI**, **Hugging Face Diffusers**, **LanceDB**, **Cloudflare Workers**, and **Eureka LLM / Creative**.

---

## OmenWorks & Related Links

Built by **[Femi Adeniran](https://femiadeniran.com/)** at **[OmenWorks](https://omenworks.dev/)** (`Apache-2.0`).

- **Proof Hub & Estimator:** [omenworks.dev](https://omenworks.dev/) · [omenworks.dev/benchmarks](https://omenworks.dev/benchmarks) · [omenworks.dev/estimator](https://omenworks.dev/estimator) · [omenworks.dev/log](https://omenworks.dev/log)
- **Visual Essays:** [Mostly Quantized](https://mostlyquantized.com/)
- **Video:** [YouTube (@omenworksdev)](https://www.youtube.com/@omenworksdev)
- **Models & Social:** [Hugging Face (OmenWorks)](https://huggingface.co/OmenWorks) · [X (@Phenomenon_One)](https://x.com/Phenomenon_One) · `hello@omenworks.dev`
