Skip to main content

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

You also need the crux-daemon binary.

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. 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

crux_sdk-0.1.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crux_sdk-0.1.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file crux_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: crux_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for crux_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2867bb89891f62dc6dfa4a2277af954e30778021df44cfd64550cc3e7c7b32a4
MD5 7f29335c9ddc1c0d0eaf44197f22efc1
BLAKE2b-256 3e078a4c3bae101524bdd585d96275f14cc89f5a27c256983d31e00b230c82d8

See more details on using hashes here.

File details

Details for the file crux_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: crux_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for crux_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28303ccedd4377b8748d6fa3277a756b35471566f0c790e266713cfca803be77
MD5 632db1954aa8503e49e09f063c7caa5a
BLAKE2b-256 a49151b84d8821d79a5b4866c40b7f507098977f3d9d5dd700f6e3a9782e9320

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page