cg find returns stored passages from your imported Claude Code history for a question, each result carrying cosine_similarity and embedding_space_id fields, and cg show opens the exact source events linked by a result.
When a session ends, finding the conversation behind a choice can be harder than remembering the choice itself.
Use cg forget to remove selected imported history from subsequent searches.
cg --version prints the binary name and its version.
Maintained by the context-graph-ai organisation on GitHub, under the Apache-2.0 licence.
Development build, not a stable release. The first development build is published by the first run of the Build development binaries workflow.
set -eu
case "$(uname -s)/$(uname -m)" in
Linux/x86_64) target=x86_64-unknown-linux-gnu ;;
Darwin/arm64) target=aarch64-apple-darwin ;;
*) echo "No development binary for this platform" >&2; exit 1 ;;
esac
base=https://github.com/context-graph-ai/context-graph/releases/download/dev-latest
curl -fLO "$base/cg-$target.tar.gz"
curl -fLO "$base/cg-$target.tar.gz.sha256"
if command -v sha256sum >/dev/null 2>&1; then
sha256sum -c "cg-$target.tar.gz.sha256"
else
shasum -a 256 -c "cg-$target.tar.gz.sha256"
fi
curl -fLO "$base/cg-$target.json"
python3 - "$target" <<'PY_RECEIPT'
import hashlib, json, pathlib, sys
stem = 'cg-' + sys.argv[1]
digest = hashlib.sha256(pathlib.Path(stem + '.tar.gz').read_bytes()).hexdigest()
receipt = json.loads(pathlib.Path(stem + '.json').read_text())
if receipt['sha256'] != digest:
raise SystemExit('Receipt digest mismatch; download a complete matching asset set again')
print('Verified source commit:', receipt['context_graph_sha'])
PY_RECEIPT
tar -xzf "cg-$target.tar.gz"
./cg --version
export PATH="$PWD:$PATH"
cg model fetch --defaultsUse the download guide for wget, receipts and provenance verification, or the newest complete run-named fallback if verification fails. The receipt identifies the source commit, workflow run and attempt. For a source build, see Contributing.
The pinned toolchain in rust-toolchain.toml is Rust 1.94.1.
ContextDB is pinned to bc9cce955eb85fb1488f5304426eedeb6d97e905 in the manifests and lockfile.
Linux is required by PR checks; macOS runs in the separate, nonblocking macOS advisory workflow. See the macOS qualification follow-up.
The default local Nomic model download is 546,938,168 bytes (about 547 MB).
A question about imported history returns stored passages.
cd ~/projects/my-app
cg import . --context my-app --search wait --format text
cg find "why did we choose this approach?" --format json
cg show <passage-id> --format text
cg status --format textIllustrative example, not a guarantee: because scoring compares embeddings rather than words, a question can return a passage that shares none of its words, as in this synthetic session about renaming src/auth.py. No automated check covers result quality for reworded questions, so results on your own history can differ.
Try this synthetic session after fetching the default model:
(
export CG_MODEL_CACHE_ROOT="${CG_MODEL_CACHE_ROOT:-${XDG_CACHE_HOME:-$HOME/.cache}/cg/models}"
demo=$(mktemp -d)
mkdir -p "$demo/home"
cat > "$demo/session.jsonl" <<'JSONL'
{"type":"assistant","uuid":"00000000-0000-4000-8000-000000000001","sessionId":"rename-example","timestamp":"2026-09-01T09:00:00Z","message":{"role":"assistant","content":"Moved src/auth.py to src/authentication.py to avoid shadowing the third-party auth package."}}
JSONL
if grep -F 'login module' "$demo/session.jsonl"; then :; else printf 'grep: no matches\n'; fi
env HOME="$demo/home" CG_DATA_ROOT="$demo/data" cg import "$demo/session.jsonl" --context rename-demo --search wait --format text
env HOME="$demo/home" CG_DATA_ROOT="$demo/data" cg find "why did we rename the login module?" --context rename-demo --limit 1 --format text
)Example output (ids and sizes differ on your machine):
grep: no matches
context: rename-demo (explicit)
sources: 1 files / 1 sessions
history captured: 1 new events (0 already present)
semantic search: caught up
<passage-id> rename-demo 2026-09-01 session rename-example
Assistant [author="assistant"]: Moved src/auth.py to src/authentication.py to avoid shadowing the third-party auth package.
Replace the project path and question; use the passage id printed by cg find. Follow getting started for the complete output and the forget recipe to remove selected history.
Directory import selects the Claude Code sessions for the chosen project; a default library store places events locally.
An import with --search wait writes events and searchable passages, and creates no Intentions, Decisions, Entities or Observations (definitions).
A default import completes capture while search is blocked by missing local model artifacts, and downloads no model.
The resulting passages can be found after the original source file is removed.
The library's default search preparation builds the ten newest sessions first. cg import --search-sessions all --search-order oldest --search wait completes coverage of all captured sessions.
See privacy and data movement for where data lives and when anything leaves the machine.
For application builders, the Rust library persists goals across store reopen, keeps choices linked to the goals they serve, and retains the link between recorded evidence and an observation. See the memory model and library quickstart.
Apache-2.0. See LICENSE.