Skip to main content

Memory graph for AI agents that learns what to retrieve — and what to suppress.

Project description

CrabPath

Pure graph engine for retrieval routing. Zero deps. Zero network calls. Caller provides embeddings and LLM callbacks.

Install

pip install crabpath             # pure graph engine
pip install crabpath[embeddings] # + local embeddings (no API key)

Python API

from crabpath import split_workspace, traverse, apply_outcome, VectorIndex

# 1. Split workspace into graph + texts
graph, texts = split_workspace("./workspace")

# 2. Caller embeds (use whatever you have)
index = VectorIndex()
for nid, content in texts.items():
    index.upsert(nid, your_embed_fn(content))

# 3. Query
seeds = index.search(your_embed_fn("how do I deploy"), top_k=8)
result = traverse(graph, seeds)

# 4. Learn
apply_outcome(graph, result.fired, outcome=1.0)

Batch Callbacks

from crabpath._batch import batch_or_single, batch_or_single_embed

# One call for all embeddings
vecs = batch_or_single_embed(
    list(texts.items()),
    embed_batch_fn=your_batch_embed
)

# One call for all LLM work
results = batch_or_single(
    [{"id": "n0", "system": "summarize", "user": content}],
    llm_batch_fn=your_batch_llm
)

Local Embeddings

pip install crabpath[embeddings]
from crabpath.embeddings import local_embed_fn, local_embed_batch_fn
# all-MiniLM-L6-v2, 80MB, CPU, no API key

CLI (pure graph ops)

crabpath init --workspace W --output O [--sessions S]
crabpath query TEXT --graph G [--index I] [--query-vector-stdin] [--top N] [--json]
crabpath learn --graph G --outcome N --fired-ids a,b,c
crabpath replay --graph G --sessions S
crabpath health --graph G
crabpath merge --graph G
crabpath connect --graph G
crabpath journal [--stats]

Reproduce Results

git clone https://github.com/jonathangu/crabpath.git && cd crabpath
pip install -e . && python sims/run_all.py

8 deterministic sims. No API keys. See REPRODUCE.md.

Paper

https://jonathangu.com/crabpath/

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

crabpath-6.1.0.tar.gz (48.1 kB view details)

Uploaded Source

Built Distribution

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

crabpath-6.1.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file crabpath-6.1.0.tar.gz.

File metadata

  • Download URL: crabpath-6.1.0.tar.gz
  • Upload date:
  • Size: 48.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for crabpath-6.1.0.tar.gz
Algorithm Hash digest
SHA256 060226edb9b90def349207d7c9020bb4db5b6b45d5d4fec43c2c9565bb4e65bc
MD5 df3b64614fea0915a899d89a4e676496
BLAKE2b-256 000949acfcbabcd4124e92021a9216ac8fd9445f3bfda1a7cc2c5063b72fce3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for crabpath-6.1.0.tar.gz:

Publisher: publish.yml on jonathangu/crabpath

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crabpath-6.1.0-py3-none-any.whl.

File metadata

  • Download URL: crabpath-6.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for crabpath-6.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9ccccfe7249d9569cfdbbd7166be2decbbc826f6e7c2e287e9e0519a070abdf
MD5 30582be9e06c7dd4ed176953591c8a1f
BLAKE2b-256 e8085b73c20d33bcb3087ef22a41dd57ffb032bfc408a6038a04805d6a58735f

See more details on using hashes here.

Provenance

The following attestation bundles were made for crabpath-6.1.0-py3-none-any.whl:

Publisher: publish.yml on jonathangu/crabpath

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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