Metadata-Version: 2.5
Name: cruxible
Version: 0.6.4
Summary: Hard state for AI agents: typed, governed, durable shared state with evidence, signed approvals, and receipts, served over a CLI, an MCP server, and a Python SDK.
Project-URL: Homepage, https://cruxible.ai
Project-URL: Documentation, https://docs.cruxible.ai
Project-URL: Repository, https://github.com/cruxible-ai/cruxible
Project-URL: Issues, https://github.com/cruxible-ai/cruxible/issues
Project-URL: Changelog, https://github.com/cruxible-ai/cruxible/blob/main/CHANGELOG.md
Author: Cruxible LLC
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: agent-memory,agent-skills,ai-agents,claude-code,deterministic,governance,hard-state,knowledge-as-code,mcp,mcp-server,ontology,provenance,receipts,state-management,workflows
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: certifi>=2026.10.18
Requires-Dist: click>=8.0
Requires-Dist: cruxible-client==0.6.4
Requires-Dist: cruxible-provider-runtime>=0.6.0
Requires-Dist: cryptography>=48.0.1
Requires-Dist: fastapi>=0.133.0
Requires-Dist: httpx>=0.24
Requires-Dist: mcp<2,>=1.30.0
Requires-Dist: packaging>=23.0
Requires-Dist: pydantic<2.14,>=2.12
Requires-Dist: pyjwt>=2.15.0
Requires-Dist: python-multipart>=0.0.31
Requires-Dist: pyyaml>=6.0
Requires-Dist: starlette>=1.3.1
Requires-Dist: structlog>=24.0
Requires-Dist: uv>=0.13.4
Requires-Dist: uvicorn[standard]>=0.20
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-timeout>=2.3; extra == 'dev'
Requires-Dist: pytest-xdist>=3.5; extra == 'dev'
Requires-Dist: pytest>=9.0.3; extra == 'dev'
Requires-Dist: ruff==0.15.0; extra == 'dev'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://cruxible.ai">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cruxible-ai/cruxible/main/assets/brand/cruxible-wordmark-white.svg">
      <img src="https://raw.githubusercontent.com/cruxible-ai/cruxible/main/assets/brand/cruxible-wordmark-black.svg" alt="Cruxible" width="360">
    </picture>
  </a>
</p>

<p align="center">
  <a href="https://pypi.org/project/cruxible/"><img src="https://img.shields.io/pypi/v/cruxible?style=flat&color=00A595" alt="PyPI version"></a>
  <a href="https://pepy.tech/projects/cruxible"><img src="https://img.shields.io/pepy/dt/cruxible?style=flat&label=downloads&color=brightgreen" alt="PyPI downloads"></a>
  <a href="https://pypi.org/project/cruxible/"><img src="https://img.shields.io/pypi/pyversions/cruxible?style=flat" alt="Python versions"></a>
  <a href="https://github.com/cruxible-ai/cruxible/blob/main/LICENSE"><img src="https://img.shields.io/github/license/cruxible-ai/cruxible?style=flat" alt="Apache-2.0 License"></a>
  <a href="https://github.com/cruxible-ai/cruxible/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://github.com/cruxible-ai/cruxible/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI status"></a>
</p>

<p align="center">
  <a href="https://cruxible.ai">Website</a> |
  <a href="https://docs.cruxible.ai">Docs</a> |
  <a href="https://cruxible.ai/kits">Kits</a> |
  <a href="https://cruxible.ai/skills">Skills</a> |
  <a href="https://github.com/cruxible-ai/cruxible/releases">Releases</a>
</p>

# Cruxible

**The state layer that lets agents earn autonomy.**

Cruxible is a **local-first, Git-backed state engine** for AI agents (CLI, MCP
server, and Python SDK). Replace sprawling Markdown with coherent, reviewable
claims that compound across runs, compile repeatable work into deterministic
Python pipelines, and graduate proven workflows from review to unattended
execution.

<p align="center">
  <a href="https://cruxible.ai">
    <img src="https://raw.githubusercontent.com/cruxible-ai/cruxible/main/assets/brand/console-state-graph.png" alt="Cruxible Console State graph showing linked Subjects, Claims, and relationships" width="100%">
  </a>
</p>

- **Fast path at zero LLM tokens:** compile repeatable retrieval, analysis,
  simulations, or custom models into deterministic Python Lines (keeping
  high-rate telemetry in an exhaust journal outside the ledger), mark failed
  sources `unknown` instead of "none", and graduate from `observe` to `propose`
  to `settle` under scoped, expiring mandates.
- **Slow path that stays coherent and amortizes compute:** your code, docs,
  APIs, and databases stay the sources of truth. People and parallel agents
  investigate once and propose narrow, typed claims backed by file pointers or
  retained Captures of any evidence (no Markdown sprawl, no two-page essays to
  audit), while long-form notes stay in plain Markdown and future runs inherit
  settled truth.
- **Falsifiable and valid until inputs move:** every judgment pins its cited
  pointers, retained Captures, and upstream premises. When one is overturned by
  new data, a file edit, or a smarter model, only the claims and dependent work
  resting on it wake back up on the slow path; everything else stays current.

No LLM runs inside Cruxible. Try it on your own repo in ~60 seconds below, ask
your agent to run `/survey`, and open `cruxible console` to inspect a live,
cited State graph of your repository's real decisions and dependencies.

## Install and start

Requirements: Python 3.11+ and Git. Linux x86-64 and macOS on Apple silicon; on
Windows, use WSL2.

```bash
uv tool install cruxible             # or: pip install cruxible
cd your-project
cruxible init --principal-id owner
cruxible skills install              # offline (.agents/skills/; add --claude for .claude/skills/), or: npx skills add cruxible-ai/cruxible
cruxible console                     # inspect the live State graph in your browser
```

`cruxible init` starts a local daemon if none is running and creates this
project's instance. Ask your agent to run `/survey` to design a minimal
vocabulary and seed your first cited State graph, or install a ready-made
starter kit with `cruxible kit add project-state --commit` (or `security`,
`iot-fleet`), then `cruxible orient && cruxible next`. To inject compact state
context automatically when a Claude Code session starts, run
`cruxible hook install`.

As you hand off higher-stakes work, add two-principal **cosign** (so a second
agent or human must approve every proposal before it counts), and graduate
repeatable checks into deterministic Lines:

```bash
cruxible init --principal-id owner --require-independent-approval
```

Follow the [Quickstart](docs/quickstart.md) to watch drift detection and
dependency cascades catch a live edit.

## See it work: fast path, slow path, and amortized triage

Deciding whether a security alert actually affects an application means
combining your dependency list, three public vulnerability feeds (advisories,
known active exploits, and exploit likelihood), your own source code, and a
reviewer's sign-off. No single scanner owns the whole picture, and Markdown
notes drift as soon as a package or file changes.

With Cruxible's **security kit** on a Django app with 32 packages:

### 1. Fast path: settle mechanical observations unattended (0 LLM tokens)

One automated pipeline reads the app's dependency list and pulls those three
feeds (OSV advisories, CISA's known-exploited catalog, and EPSS exploit
scores). Because pulling declared feeds is mechanical, these Lines hold
explicit, expiring `settle` mandates and record both matches and verified
absences (only marking "not actively exploited" when the full catalog loaded).
Out of 181 findings, only the 7 high-risk unjudged exposures wake the slow path:

```console
$ cruxible runbook run security.start
   1  Line:security.sbom-import.app              written 32 (settled 32, proposed 0)
   2  Line:security.osv-query                    written 181 (settled 181, proposed 0)
   3  Line:security.kev-triage                   written 181 (settled 181, proposed 0)
   4  Line:security.epss-triage                  written 543 (settled 543, proposed 0)
   5  Line:security.exposure-attention.unjudged  inbox 7 new
```

### 2. Slow path: record a cited judgment once; cosign in four lines

Judging whether a vulnerability is actually reachable is the agent's job. It
inspects the repository, finds that the app lists `PyYAML 5.1` while the only
`yaml.load` call lives in a separate container, and proposes a `not_affected`
judgment citing that exact line:

```python
from cruxible_client import Cruxible, FileEvidence

with Cruxible.connect() as cx:
    w = cx.world()  # typed against .cruxible/world.pyi
    w.security.app_exposure.define(
        occurrence=w.security.occurrence["sbom.cdx.json--pkg-pypi-pyyaml-5.1"],
        vulnerability=w.security.vulnerability["cve-2020-14343"],
    ).set(
        justification="vulnerable_code_not_in_execute_path",
        evidence=FileEvidence(
            # Single-line quote (`PATH#TEXT`) or 1-indexed line range (`file="...", lines=(12, 18)`)
            file="dockerized_labs/a9_uckv_lab/app.py#data = yaml.load(file.stream, Loader=yaml.Loader)"
        ),
    ).write(
        because=(
            "CVE-2020-14343: the only yaml.load in the repo is in dockerized_labs/a9_uckv_lab, "
            "a separate container with its own requirements; the Django app never imports yaml."
        ),
        accept="never",  # -> proposal; a second principal reviews and signs it
    )
```

A second agent (or human) acting as `reviewer` sees the domain guidance, the
proposed verdict, and the cited line before signing off, instead of auditing a
multi-page session transcript:

```console
$ CRUXIBLE_PRINCIPAL_ID=reviewer cruxible proposal review 54251d28...
Guidance: document:security.guidance.dependency (Judging a dependency exposure)
  set ...pyyaml-5.1--cve-2020-14343 justification: vulnerable_code_not_in_execute_path  [verdict supported]
    cites dockerized_labs/a9_uckv_lab/app.py
      | data = yaml.load(file.stream, Loader=yaml.Loader)
```

### 3. Amortized upkeep: wake the slow path only for what moved

When `PyYAML` is upgraded and the pipeline runs again, the fast path re-checks
all 32 packages at zero LLM tokens. Only the changed package and advisory are
written; the attention Line posts only the 1 new unjudged exposure to the inbox
while existing ones deduplicate and every other package and settled judgment
stays untouched:

```console
$ cruxible runbook run security.start
   1  Line:security.sbom-import.app              written 1; unchanged 31; retired 1
   2  Line:security.osv-query                    written 1; unchanged 178
   3  Line:security.kev-triage                   written 0; unchanged 179
   4  Line:security.epss-triage                  written 0; unchanged 537
   5  Line:security.exposure-attention.unjudged  inbox 1 new, 6 seen again
```

If someone instead edits the cited line in `dockerized_labs/a9_uckv_lab/app.py`,
`cruxible next` brings that specific judgment back to the slow path as
`citation_drifted` so a later session re-verifies it instead of trusting a
stale waiver:

```console
$ cruxible next
repair  citation_drifted  Claim:CLM-34cb42d7...  next=cruxible.rebind
  repair: cruxible rebind CLM-34cb42d7... --because '<TEXT>'
```

Every field keeps its signed history and provenance:

```console
$ cruxible get security.app_exposure/sbom.cdx.json--pkg-pypi-pyyaml-5.1--cve-2020-14343 --detail history
justification
  proposed 2026-11-18 by owner, approved by reviewer  stated  vulnerable_code_not_in_execute_path
      reason: CVE-2020-14343: the only yaml.load in the repo is in dockerized_labs/a9_uckv_lab, a
      separate container with its own requirements; the Django app this SBOM describes never imports yaml.
```

See the full [Security walkthrough](docs/security-walkthrough.md) to run this
on your own repository. Security is one domain: see also the
[Project state walkthrough](docs/project-state-walkthrough.md) (coding-agent
session handoffs, doc citations, and selective dependency cascades) and the
[IoT fleet walkthrough](docs/iot-fleet-walkthrough.md) (deterministic EWMA
telemetry at zero LLM tokens). `cruxible console` opens a read-only view of any
instance in your browser.

## Why Cruxible

Autonomous, multi-session work stalls when every run starts cold, conclusions
drift silently, and authority is all-or-nothing:

- **Spend compute once on the slow path; amortize it on the fast path.** Every
  unit of agent compute should leave behind either a verified, cited claim or a
  deterministic Python pipeline, not an ephemeral transcript. Like Hora in
  Herbert Simon's
  [watchmakers](https://faculty.sites.iastate.edu/tesfatsi/archive/tesfatsi/ArchitectureOfComplexity.HSimon1962.pdf#page=5),
  agents build stable subassemblies that survive context resets and align
  swarms. As models improve, you spend compute directly to sharpen or overturn
  targeted premises without re-running everything else.
- **Not a second source of truth: pointers and Captures over what you already
  have.** Your repos, databases, APIs, sensors, and SaaS tools remain the
  sources of truth for their own records. Cruxible sits at the judgment layer
  across them, linking typed claims to file pointers and retained Captures of
  any evidence without copying whole tables or locking your decision history
  inside one vendor.
- **Text alone and facts alone both lose; pairing them wins.** In
  [LongMemEval](https://arxiv.org/abs/2410.10813) (ICLR 2025), reducing memory
  to extracted facts lowered accuracy, while indexing structured facts
  alongside full text beat text alone; in
  [MemoryAgentBench](https://arxiv.org/abs/2507.05257), note-based systems
  repeatedly failed to let newer statements override older contradicting ones.
  Cruxible keeps long-form reasoning in plain Markdown to read and grep, while
  typed claims hold the single current truth, answer exact set queries
  (`NOT EXISTS`, counts), and wake up when cited pointers, Captures, or
  upstream claims move.
- **A database or CSV + Python stores what was written; Cruxible tracks whether
  it still holds.** For a straightforward table or script, SQLite, Postgres, or
  CSV is plenty (Cruxible itself indexes into SQLite). Once agents and teams
  rely on conclusions across sessions, you end up building the same layer
  around it: citation-drift checks, cascades when upstream premises move,
  verified *none* vs. *unknown*, proposal review, and versioned history.
  Cruxible provides that layer out of the box behind one typed interface.

Cruxible gives agents and teams:

- **Graduated automation (`observe` -> `propose` -> `settle`).** Pipelines
  start by observing or proposing for review, and only settle named fields
  unattended under explicit, scoped, expiring mandates.
- **The structure coding agents naturally want.** Agents run exact typed
  queries, grep plain Markdown and readable local YAML mirrors in
  `.cruxible/floor/`, and write Python to batch updates or turn any repeatable
  retrieval, analysis, simulation, or model into a deterministic pipeline.
- **Freshness, cascades, and completeness, not silent drift.** Pipelines
  re-check facts on a trigger or schedule, freshness windows flag expired
  evidence, drift checks catch edited citations and wake dependent claims when
  upstream decisions change, and Cruxible distinguishes **found**, verified
  **none** (from a complete source read), and **unknown** so a failed lookup
  never reads as "safe."
- **Governed, verifiable history.** Every change is a proposal checked
  deterministically under your approval policy and recorded in a signed Git
  ledger where any earlier generation can be read back as it stood.

## Use it from your agent

One local daemon owns accepted state (`cruxible init` starts it automatically,
or run `cruxible server start` explicitly); agents interact with it however
they work best:

- **Python SDK (`cruxible python`):** typed handles from `.cruxible/world.pyi`,
  atomic write batches, and zero-setup execution from any repository
  ([SDK reference](packages/cruxible-client/README.md)).
- **CLI & local files:** `orient`, `query`, `get`, `next`, `set`, `write`, and
  `authoring` (with `--json`), plus readable YAML mirrors in `.cruxible/floor/`
  to grep alongside your Markdown docs ([CLI reference](docs/cli-reference.md)).
- **MCP:** `uvx cruxible mcp` for agents without a shell or code environment;
  also serves core and installed kit skills over the MCP Skills extension
  (SEP-2640) ([MCP tools](docs/mcp-tools.md)).

Install the five core skills (`survey`, `adopt-kit`, `create-state`,
`automate-state`, `review-state`) directly from the installed CLI with no Node
or network (`cruxible skills install`, or `--claude` for `.claude/skills/`), or
across 75+ agents with `npx skills add cruxible-ai/cruxible` (kit skills:
`npx skills add cruxible-ai/cruxible-kits`). Optional `SessionStart` orientation
hooks install via `cruxible hook install`. See [For AI agents](docs/for-ai-agents.md)
(optional plugin bundles live in [plugins/README.md](plugins/README.md)).

## How it works

- **Claims, Subjects, and Evidence.** Each fact is a Claim about a Subject
  under a ClaimType that declares its value type, cardinality, freshness, and
  admitted evidence: the author's own words, a cited passage in a workspace
  file, or a retained Capture under a declared contract.
  ([Evidence and admission](docs/evidence-and-admission.md),
  [Asking questions](docs/asking-questions.md))
- **Proposals and signed history.** Every mutation is a proposal checked
  deterministically and accepted under your approval policy with signed
  approvals into a Git ledger. High-rate run telemetry stays in operational
  exhaust outside the ledger.
  ([Review and governance](docs/review-and-governance.md),
  [Architecture](docs/architecture.md))
- **Procedures, Lines, and Triggers.** A Procedure is a reviewed, replayable
  graph of steps that reads accepted state, invokes pinned provider builds
  through typed capability slots, extracts typed records, and proposes,
  settles, or posts to the inbox. Because computation lives in pinned provider
  packages (anything from API fetches and SQL queries to static analyzers or
  custom ML models), teams and agents can push any repeatable retrieval or
  derivation into a governed pipeline. A Line binds a Procedure's inputs,
  budgets, and authority ceiling to Triggers (cron, cadence, capture landing,
  or accepted changes).
  ([Lines and automation](docs/lines-and-automation.md))
- **Kits.** A domain (its vocabulary, queries, guidance documents, Procedures,
  skills, and bundled providers) travels between instances as a kit, installed and
  upgraded as reviewed changes. ([Kits](docs/kits.md))
- **Credentials and principals.** A credential is a daemon bearer token with a
  permission tier (`read_only`, `governed_write`, `graph_write`, `admin`); a
  principal is a signing key that attributes acts and signs approvals.
  ([Who acts](docs/concepts.md#who-acts))

The [concepts guide](docs/concepts.md) walks through all of these in order.

## Documentation

Pick a starting point based on what you're trying to do (or browse the
[full index](docs/index.md)):

| If you want to… | Start here |
|---|---|
| **Try Cruxible on a real repo in minutes** | [Quickstart](docs/quickstart.md), plus walkthroughs for [Project state](docs/project-state-walkthrough.md), [Security](docs/security-walkthrough.md), and [IoT fleet](docs/iot-fleet-walkthrough.md) |
| **Understand the mental model and vocabulary** | [Concepts](docs/concepts.md), [Architecture](docs/architecture.md) |
| **Connect an AI agent (MCP, CLI, SDK, skills)** | [For AI agents](docs/for-ai-agents.md), [Skills](skills/) (`npx skills add cruxible-ai/cruxible`) |
| **Decide what to model as state vs. prose** | [Building team knowledge](docs/building-team-knowledge.md) (modeling habits and *Mistakes we made ourselves*) |
| **Keep Markdown docs in sync with live state** | [Documents and notes](docs/documents-and-notes.md) (atomic note+Claim writes, review guidance, and self-updating **projection blocks**) |
| **Require stronger evidence or track predictions** | [Evidence and admission](docs/evidence-and-admission.md) (admission rules, freshness, attestations, and **predictions**) |
| **Query across relations or time-travel history** | [Asking questions](docs/asking-questions.md) (`--follow`, saved queries, `--at`, and grepping `.cruxible/floor/`) |
| **Work drift queues and decide what to verify** | [Keeping knowledge current](docs/keeping-knowledge-current.md) (`next` repairs, duplicates, `audit` ranking, and none vs. unknown) |
| **Build scheduled pipelines or custom providers** | [Lines and automation](docs/lines-and-automation.md) (Procedures, pinned providers, inbox posts, and earning `settle` mandates) |
| **Lock down review, cosign, or propose-only agents** | [Review and governance](docs/review-and-governance.md) (approval policies, `governed_write` agents, and trust boundaries) |
| **Evolve schemas or package reusable domains** | [Evolving your vocabulary](docs/evolving-your-vocabulary.md) (migrating Claims without losing history), [Kits](docs/kits.md) |

**Reference & operations:** [CLI reference](docs/cli-reference.md) |
[MCP tools](docs/mcp-tools.md) |
[Python SDK](packages/cruxible-client/README.md) |
[Isolated deployment](docs/isolated-deployment.md) |
[Upgrading](docs/upgrading.md) |
[Data and network](docs/data-and-network.md) |
[Hosted runtime image](docs/hosted-runtime-image.md)

## Develop

```bash
git clone https://github.com/cruxible-ai/cruxible
cd cruxible
uv sync --all-packages --all-extras
uv run pytest -n auto --dist loadfile
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for provider-runtime tests, lint,
format, and type checks.

Apache-2.0 licensed.

<!-- mcp-name: io.github.cruxible-ai/cruxible-core -->
