Files
yvgude--lean-ctx/integrations/hermes-lean-ctx/scripts/install.sh
T
wehub-resource-sync 26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

62 lines
2.0 KiB
Bash

#!/usr/bin/env bash
# Install hermes-lean-ctx into a Hermes Agent plugins directory by symlinking
# this checkout, so `git pull` keeps it up to date.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
PLUGIN_NAME="hermes-lean-ctx"
HERMES_HOME_DIR="${HERMES_HOME:-$HOME/.hermes}"
if [[ -n "${HERMES_PROFILE:-}" ]]; then
TARGET_DIR="$HERMES_HOME_DIR/profiles/${HERMES_PROFILE}/plugins/$PLUGIN_NAME"
else
TARGET_DIR="$HERMES_HOME_DIR/plugins/$PLUGIN_NAME"
fi
mkdir -p "$(dirname "$TARGET_DIR")"
if [[ -L "$TARGET_DIR" ]]; then
CURRENT_TARGET="$(readlink "$TARGET_DIR")"
if [[ "$CURRENT_TARGET" != "$REPO_ROOT" ]]; then
echo "Refusing to replace existing symlink: $TARGET_DIR -> $CURRENT_TARGET" >&2
echo "Remove it or point it at this checkout before rerunning install.sh." >&2
exit 1
fi
elif [[ -e "$TARGET_DIR" ]]; then
echo "Refusing to replace existing path: $TARGET_DIR" >&2
echo "Move it aside or remove it before rerunning install.sh." >&2
exit 1
else
ln -s "$REPO_ROOT" "$TARGET_DIR"
fi
if ! python3 -c "import leanctx" >/dev/null 2>&1; then
echo "Note: the 'leanctx' SDK is not importable in this Python." >&2
echo " Install it in Hermes' environment: pip install lean-ctx-client" >&2
fi
cat <<EOF
Installed $PLUGIN_NAME -> $TARGET_DIR
Next steps:
1. Start the lean-ctx HTTP tools API (serves /v1, default port 8080):
lean-ctx serve --host 127.0.0.1 --port 8080
(The always-on proxy on 4444+ does NOT serve /v1/tools — use 'serve'.)
2. Install the SDK in Hermes' Python: pip install lean-ctx-client
3. Activate the engine in ~/.hermes/config.yaml:
context:
engine: "lean-ctx"
4. Point the plugin at the server if it is not on the default:
export LEANCTX_BASE_URL=http://127.0.0.1:8080
# export LEANCTX_TOKEN=<token> # if 'serve --auth-token' is used
5. (Optional) tune via env: LEANCTX_CONTEXT_LENGTH,
LEANCTX_THRESHOLD_FRACTION, LEANCTX_PROTECT_FRACTION, LEANCTX_CORE_COMPACTION.
EOF