crux-sdk
Python SDK for Crux -- agentic knowledge versioning.
Crux tracks what an AI agent believes about the world and tells it when those beliefs go stale. This SDK connects to the Crux daemon over a Unix socket.
Install
pip install crux-sdk
Quick start
from crux import WorldModel, CruxInterceptor
world = WorldModel(socket_path="/tmp/crux.sock")
tools = CruxInterceptor(world)
# These automatically register beliefs
content = tools.read_file("config.json")
tools.write_file("output.py", "print('hello')")
stdout, code = tools.run_shell("git status")
# Query a belief
belief = world.query("file", path="/absolute/path/to/config.json")
print(belief.status) # "valid", "uncertain", or "invalidated"
print(belief.confidence) # 0.0 to 1.0
# Check for pending invalidations
diff = world.diff()
if not diff.is_empty():
print(f"{len(diff.invalidated)} beliefs invalidated")
# Plans as beliefs -- fence pattern
world.create_plan("refactor-auth", goal="Refactor auth module")
# Plan auto-depends on all beliefs read since the last plan
world.close()
Claude Code integration
Add hooks to .claude/settings.json to auto-register every Read/Write/Edit/Bash tool call. A PreToolUse hook surfaces stale beliefs before each tool call, and a PostToolUse hook records observations after. See the full README for setup.
Features
- Typed belief graph with causal dependency edges
- Convention-based auto-edges (writes depend on recent reads)
- Plans as first-class beliefs with fence-pattern auto-edges
- TTL-based belief expiry (shell: 30s, file: 60s, http: 2min, env: 5min)
- Stability filter for oscillating beliefs
- Field-level edge filtering for selective invalidation
- Schema evolution detection
- Append-only event log with crash recovery
- Branching for speculative agent work
- Historical queries (query_at)
Links
Metadata
Release files for crux-sdk 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| crux_sdk-0.3.0.tar.gz | 20.5 kB | Without provenance | Details for crux_sdk-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crux_sdk-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for crux_sdk-0.3.0-py3-none-any.whl |
Total release size: 40.9 kB
Release files / crux_sdk-0.3.0.tar.gz
| Download URL | crux_sdk-0.3.0.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0260df163702c146b96f441097ba1684ee9fc6f3ebd1f54b500af8f61e9dc7f2
|
|
BLAKE2b-256 checksum How to use checksums |
942720057633cee9979e815d9a2312afff40bf975a74daf32abd4e37eb6119ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Release files / crux_sdk-0.3.0-py3-none-any.whl
| Download URL | crux_sdk-0.3.0-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
877d1ca49bed8b39a87e1dca62471142821f39d8c771adfb76a4974bfe66398a
|
|
BLAKE2b-256 checksum How to use checksums |
bf159fe5f2c7490ddeca5ec1375eb2113c8a3b7b777d7e7baae05b653fbee936
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Security for crux-sdk 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.