Python SDK for Crux -- agentic knowledge versioning
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crux_sdk-0.3.0.tar.gz.
File metadata
- Download URL: crux_sdk-0.3.0.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0260df163702c146b96f441097ba1684ee9fc6f3ebd1f54b500af8f61e9dc7f2
|
|
| MD5 |
358155ff7629166b7c45a0735e5f443e
|
|
| BLAKE2b-256 |
942720057633cee9979e815d9a2312afff40bf975a74daf32abd4e37eb6119ba
|
File details
Details for the file crux_sdk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: crux_sdk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
877d1ca49bed8b39a87e1dca62471142821f39d8c771adfb76a4974bfe66398a
|
|
| MD5 |
4b42d6beeecbbcd32d1b0c18dc20868d
|
|
| BLAKE2b-256 |
bf159fe5f2c7490ddeca5ec1375eb2113c8a3b7b777d7e7baae05b653fbee936
|