Cruxible

PyPI version PyPI downloads Python versions Apache-2.0 License CI status

Website | Docs | Kits | Skills | Releases

# Cruxible **Let agents learn your world and earn autonomy.** Cruxible is a **local-first, Git-backed state engine** for AI agents (CLI, MCP server, and Python SDK). Supplement text memory with typed, cited claims and deterministic Python pipelines, and graduate proven workflows from review to unattended execution.

Cruxible Console State graph showing linked Subjects, Claims, and relationships

- **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. - **Passive attention, falsifiable until inputs move:** instead of agents actively polling files and feeds every session, 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, `cruxible next` (and the optional `SessionStart` hook) wakes only the claims and dependent work resting on it back up on the slow path, staying silent when everything else is 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 init` starts a local daemon if none is running and creates this project's instance. Install a ready-made starter kit with `cruxible kit add project-state --commit` (or `security`, `iot-fleet`), or ask your agent to run `/survey` to design a minimal vocabulary and seed your first cited claims, then run `cruxible orient && cruxible next` and open `cruxible console` to inspect the live State graph in your browser. To inject compact state context automatically when a Claude Code session starts, run `cruxible hook install`. For a **new** repository where higher-stakes work requires two-principal **cosign** (so a second agent or human must approve every proposal before it counts), pass `--require-independent-approval` to `init` in place of the first command: ```bash cruxible init --principal-id owner --require-independent-approval ``` On an already-initialized repository, register a reviewer and submit an approval policy as shown in [Review and governance](docs/review-and-governance.md). 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 "absent from the CISA KEV catalog" when the full catalog loaded). In this excerpt (with `--param min_epss=0.05`; the walkthrough's recorded run at the default `0.1` threshold pages 0 items because the highest EPSS score was `0.0624`, while all 181 findings stay queryable in `security.urgent_exposures`), only the 7 exposures crossing the threshold 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 '' ``` 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 stores what was written; Cruxible tracks whether it still holds.** Cruxible indexes into SQLite internally; on top of that, it tracks which claims cite a changed passage or Capture, which work depends on a revised premise, and what needs review before it counts. 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.