#!/usr/bin/env bash # edgeless-memory — one-line installer # curl -fsSL https://raw.githubusercontent.com/edgeless-ai/edgeless-memory/main/install.sh | bash # # Prefer to read it first? # curl -fsSL https://raw.githubusercontent.com/edgeless-ai/edgeless-memory/main/install.sh -o install.sh # less install.sh && bash install.sh # # Sets up all three tiers for real: # - SQLite (stdlib, always) # - ChromaDB (pip install, semantic search; heavy dep — pulls onnxruntime, ~hundreds of MB) # - Obsidian-compatible markdown vault # # Safe by design: no sudo, writes confined to $HOME_DIR, idempotent. The whole # body runs inside main() invoked on the last line, so a truncated download # can never execute a partial script. set -euo pipefail main() { HOME_DIR="${EDGELESS_MEMORY_HOME:-$HOME/.edgeless-memory}" REPO="${EDGELESS_MEMORY_REPO:-https://raw.githubusercontent.com/edgeless-ai/edgeless-memory/main}" PY="$(command -v python3 || true)" # display-only: show ~ instead of the raw home dir case "$HOME_DIR" in "$HOME"/*) DISP="~${HOME_DIR#"$HOME"}";; *) DISP="$HOME_DIR";; esac echo "edgeless-memory — installing to $DISP" [ -z "$PY" ] && { echo "error: python3 (>=3.9) not found"; exit 1; } # 1. Layout (sqlite data, obsidian vault, chroma store) mkdir -p "$HOME_DIR"/{bin,data,vault,chroma} # 2. Core CLI (curl when piped from web; copy when run from a clone) if [ -f "$(dirname "$0")/edgeless_memory.py" ]; then cp "$(dirname "$0")/edgeless_memory.py" "$HOME_DIR/bin/" cp "$(dirname "$0")/sia_loop.py" "$HOME_DIR/bin/" 2>/dev/null || true else curl -fsSL "$REPO/edgeless_memory.py" -o "$HOME_DIR/bin/edgeless_memory.py" curl -fsSL "$REPO/sia_loop.py" -o "$HOME_DIR/bin/sia_loop.py" 2>/dev/null || true fi chmod +x "$HOME_DIR"/bin/*.py # 3. ChromaDB (semantic tier). Non-fatal — the tool degrades to SQLite if absent. if "$PY" -c "import chromadb" 2>/dev/null; then echo " chromadb: already present" else echo " chromadb: installing (semantic search; heavy dep, may take a minute)…" if "$PY" -m pip install --quiet --user "chromadb>=0.5" 2>/dev/null; then echo " chromadb: installed" else echo " chromadb: skipped — pip refused (PEP 668 / externally-managed env, e.g. Homebrew or Debian)." echo " for semantic search, install into a venv:" echo " python3 -m venv ~/.edgeless-memory/venv" echo " ~/.edgeless-memory/venv/bin/pip install 'chromadb>=0.5'" echo " (without it, search still works via keyword/SQLite.)" fi fi # 4. Obsidian vault marker so the folder opens cleanly as a vault mkdir -p "$HOME_DIR/vault/.obsidian" [ -f "$HOME_DIR/vault/.obsidian/app.json" ] || echo '{}' > "$HOME_DIR/vault/.obsidian/app.json" # 5. Convenience launcher on PATH cat > "$HOME_DIR/bin/edgeless-memory" <