Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(scripts): remove obsolete memory benchmark and debug scripts

Steven Enamakele018d1314082
diff --git a/scripts/bench-memory-retrieval.sh b/scripts/bench-memory-retrieval.sh
deleted file mode 100755
index be0fcd945d..0000000000
--- a/scripts/bench-memory-retrieval.sh
+++ /dev/null
@@ -1,193 +0,0 @@
-#!/usr/bin/env bash
-# bench-memory-retrieval.sh — benchmark memory retrieval quality and latency.
-#
-# Tests the core's memory query (semantic search) and tree file-based content
-# retrieval against a set of benchmark queries. Measures wall-clock time per
-# query, result count, and content quality.
-#
-# Usage:
-# ./scripts/bench-memory-retrieval.sh
-# ./scripts/bench-memory-retrieval.sh --verbose
-
-set -euo pipefail
-
-SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
-REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
-
-VERBOSE=0
-[[ "${1:-}" == "--verbose" ]] && VERBOSE=1
-
-CORE_BIN="$REPO_ROOT/target/debug/openhuman-core"
-if [[ ! -x "$CORE_BIN" ]]; then
- echo "ERROR: Build openhuman-core first: cargo build --bin openhuman-core"
- exit 1
-fi
-
-WORKSPACE_DIR="${OPENHUMAN_WORKSPACE:-$HOME/.openhuman-staging}"
-USERS_DIR="$WORKSPACE_DIR/users"
-
-if [[ ! -d "$USERS_DIR" ]]; then
- echo "ERROR: Workspace users dir not found: $USERS_DIR"
- exit 1
-fi
-
-# Find first user workspace with memory_tree content
-CONTENT_ROOT=$(find "$USERS_DIR" -path "*/workspace/memory_tree/content" -type d 2>/dev/null | head -1 || true)
-if [[ -z "$CONTENT_ROOT" ]]; then
- echo "ERROR: No memory_tree content found under $USERS_DIR/"
- exit 1
-fi
-RESULTS_DIR="$REPO_ROOT/target/bench-memory"
-mkdir -p "$RESULTS_DIR"
-TIMESTAMP=$(date +%Y%m%d-%H%M%S)
-RESULTS_FILE="$RESULTS_DIR/retrieval-$TIMESTAMP.txt"
-
-# Inventory
-FILE_COUNT=$(find "$CONTENT_ROOT" -type f -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
-TOTAL_SIZE=$(du -sh "$CONTENT_ROOT" 2>/dev/null | cut -f1)
-CHAT_COUNT=$(find "$CONTENT_ROOT/chat" -type f -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
-EPISODIC_COUNT=$(find "$CONTENT_ROOT/episodic" -type f -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
-RAW_COUNT=$(find "$CONTENT_ROOT/raw" -type f -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
-WIKI_COUNT=$(find "$CONTENT_ROOT/wiki" -type f -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
-
-cat <<EOF | tee "$RESULTS_FILE"
-==============================================================
- Memory Retrieval Benchmark
- $(date)
-==============================================================
-
-Content root: $CONTENT_ROOT
-Total files: $FILE_COUNT markdown files ($TOTAL_SIZE)
- chat: $CHAT_COUNT files
- episodic: $EPISODIC_COUNT files
- raw: $RAW_COUNT files
- wiki: $WIKI_COUNT files
-
---------------------------------------------------------------
- 1. KV Memory Recall (semantic search via SQLite)
---------------------------------------------------------------
-EOF
-
-QUERIES=(
- "what are the most important things to work on"
- "what projects have I been discussing recently"
- "what are my preferences and settings"
- "what people have I interacted with"
- "what technical decisions have been made"
-)
-
-export OPENHUMAN_APP_ENV=staging
-export OPENHUMAN_KEYRING_BACKEND=file
-
-for query in "${QUERIES[@]}"; do
- echo "" | tee -a "$RESULTS_FILE"
- echo "Query: $query" | tee -a "$RESULTS_FILE"
-
- START_NS=$(python3 -c "import time; print(int(time.time()*1e9))")
-
- OUTPUT=$(RUST_LOG=error "$CORE_BIN" memory query -n global -q "$query" 2>&1) || true
-
- END_NS=$(python3 -c "import time; print(int(time.time()*1e9))")
- ELAPSED_MS=$(python3 -c "print(($END_NS - $START_NS) / 1_000_000)")
-
- RESULT_COUNT=$(echo "$OUTPUT" | grep -c '^\[' || true)
- FIRST_RESULT=$(echo "$OUTPUT" | grep '^\[' | head -1 | cut -c1-120)
-
- echo " -> ${ELAPSED_MS}ms, $RESULT_COUNT results" | tee -a "$RESULTS_FILE"
- if [[ -n "$FIRST_RESULT" ]]; then
- echo " -> Top: $FIRST_RESULT..." | tee -a "$RESULTS_FILE"
- fi
-
- if [[ $VERBOSE -eq 1 ]]; then
- echo "$OUTPUT" | head -20
- fi
-done
-
-cat <<EOF | tee -a "$RESULTS_FILE"
-
---------------------------------------------------------------
- 2. Tree Content File Walk (direct file scan)
---------------------------------------------------------------
-EOF
-
-# Benchmark file-based tree walking: grep across content files
-TREE_QUERIES=(
- "OpenHuman"
- "memory"
- "important"
- "project"
- "preference"
-)
-
-for pattern in "${TREE_QUERIES[@]}"; do
- echo "" | tee -a "$RESULTS_FILE"
- echo "Pattern: $pattern" | tee -a "$RESULTS_FILE"
-
- START_NS=$(python3 -c "import time; print(int(time.time()*1e9))")
-
- HIT_COUNT=$(grep -rl "$pattern" "$CONTENT_ROOT" 2>/dev/null | wc -l | tr -d ' ')
- SAMPLE=$(grep -rl "$pattern" "$CONTENT_ROOT" 2>/dev/null | head -3 | while read f; do
- basename "$f" | tr '\n' ' '
- done)
-
- END_NS=$(python3 -c "import time; print(int(time.time()*1e9))")
- ELAPSED_MS=$(python3 -c "print(($END_NS - $START_NS) / 1_000_000)")
-
- echo " -> ${ELAPSED_MS}ms, $HIT_COUNT files matched" | tee -a "$RESULTS_FILE"
- if [[ -n "$SAMPLE" ]]; then
- echo " -> Sample: $SAMPLE" | tee -a "$RESULTS_FILE"
- fi
-done
-
-cat <<EOF | tee -a "$RESULTS_FILE"
-
---------------------------------------------------------------
- 3. RPC Memory Tree API (structured retrieval)
---------------------------------------------------------------
-EOF
-
-# Test the tree RPC APIs
-RPC_METHODS=(
- "openhuman.memory_tree_search_entities::{\"query\":\"OpenHuman project\",\"limit\":5}"
- "openhuman.memory_tree_query_source::{\"source_kind\":\"chat\",\"limit\":5}"
- "openhuman.memory_tree_query_source::{\"source_kind\":\"episodic\",\"limit\":5}"
-)
-
-for spec in "${RPC_METHODS[@]}"; do
- METHOD="${spec%%::*}"
- PARAMS="${spec##*::}"
-
- echo "" | tee -a "$RESULTS_FILE"
- echo "RPC: $METHOD" | tee -a "$RESULTS_FILE"
- echo " params: $PARAMS" | tee -a "$RESULTS_FILE"
-
- START_NS=$(python3 -c "import time; print(int(time.time()*1e9))")
-
- OUTPUT=$(RUST_LOG=error "$CORE_BIN" call --method "$METHOD" --params "$PARAMS" 2>&1) || true
-
- END_NS=$(python3 -c "import time; print(int(time.time()*1e9))")
- ELAPSED_MS=$(python3 -c "print(($END_NS - $START_NS) / 1_000_000)")
-
- # Extract hit count from JSON
- HITS=$(echo "$OUTPUT" | python3 -c "
-import sys,json
-raw = sys.stdin.read()
-last_line = [l for l in raw.split('\n') if '{' in l]
-d = json.loads(last_line[-1]) if last_line else {}
-print(d.get('result',{}).get('total',0))
-" 2>/dev/null || echo "parse-error")
-
- echo " -> ${ELAPSED_MS}ms, hits=$HITS" | tee -a "$RESULTS_FILE"
-
- if [[ $VERBOSE -eq 1 ]]; then
- echo "$OUTPUT" | tail -5
- fi
-done
-
-cat <<EOF | tee -a "$RESULTS_FILE"
-
-==============================================================
- Summary
-==============================================================
-Results saved to: $RESULTS_FILE
-EOF
diff --git a/scripts/bench-memory-walk.sh b/scripts/bench-memory-walk.sh
deleted file mode 100755
index 5da5915c7a..0000000000
--- a/scripts/bench-memory-walk.sh
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/env bash
-# bench-memory-walk.sh — benchmark memory tree walking and retrieval performance.
-#
-# Calls the core CLI with a set of test queries against the memory tree,
-# measures latency per query, and reports summary statistics.
-#
-# Usage:
-# ./scripts/bench-memory-walk.sh # defaults
-# ./scripts/bench-memory-walk.sh --query "what is X?" # single query
-# ./scripts/bench-memory-walk.sh --content-root /path/to/tree # custom root
-# ./scripts/bench-memory-walk.sh --max-turns 20 # more turns
-# ./scripts/bench-memory-walk.sh --model "deepseek:deepseek-chat"
-# ./scripts/bench-memory-walk.sh --verbose # show full output
-
-set -euo pipefail
-
-SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
-REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
-
-# Defaults
-CONTENT_ROOT="${OPENHUMAN_MEMORY_CONTENT_ROOT:-$HOME/.openhuman-staging/users/69d9cb73e61f755583c3671f/workspace/memory_tree/content}"
-MAX_TURNS=12
-NAMESPACE="default"
-MODEL=""
-VERBOSE=0
-CUSTOM_QUERY=""
-
-# Default benchmark queries covering different retrieval patterns
-DEFAULT_QUERIES=(
- "What projects am I working on?"
- "What did I discuss in my most recent conversations?"
- "What are my preferences and settings?"
- "Find any mentions of GitHub or pull requests"
- "What people have I interacted with recently?"
-)
-
-while [[ $# -gt 0 ]]; do
- case "$1" in
- --content-root) CONTENT_ROOT="$2"; shift 2 ;;
- --max-turns) MAX_TURNS="$2"; shift 2 ;;
- --namespace) NAMESPACE="$2"; shift 2 ;;
- --model) MODEL="$2"; shift 2 ;;
- --query) CUSTOM_QUERY="$2"; shift 2 ;;
- --verbose) VERBOSE=1; shift ;;
- -h|--help)
- echo "Usage: $0 [OPTIONS]"
- echo ""
- echo "Options:"
- echo " --content-root PATH Memory tree content root (default: staging)"
- echo " --max-turns N Max LLM turns per query (default: 12)"
- echo " --namespace NS Memory namespace (default: 'default')"
- echo " --model MODEL Provider:model override"
- echo " --query TEXT Run a single custom query instead of defaults"
- echo " --verbose Show full tool output"
- echo " -h, --help Show this help"
- exit 0
- ;;
- *) echo "Unknown option: $1"; exit 1 ;;
- esac
-done
-
-# Verify content root exists
-if [[ ! -d "$CONTENT_ROOT" ]]; then
- echo "ERROR: Content root does not exist: $CONTENT_ROOT"
- echo "Set OPENHUMAN_MEMORY_CONTENT_ROOT or use --content-root"
- exit 1
-fi
-
-# Count files in the tree
-FILE_COUNT=$(find "$CONTENT_ROOT" -type f -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
-DIR_COUNT=$(find "$CONTENT_ROOT" -type d 2>/dev/null | wc -l | tr -d ' ')
-TOTAL_SIZE=$(du -sh "$CONTENT_ROOT" 2>/dev/null | cut -f1)
-
-echo "=============================================="
-echo " Memory Tree Walk Benchmark"
-echo "=============================================="
-echo ""
-echo "Content root: $CONTENT_ROOT"
-echo "Files: $FILE_COUNT markdown files"
-echo "Directories: $DIR_COUNT"
-echo "Total size: $TOTAL_SIZE"
-echo "Max turns: $MAX_TURNS"
-echo "Namespace: $NAMESPACE"
-if [[ -n "$MODEL" ]]; then
- echo "Model: $MODEL"
-fi
-echo ""
-
-# Build the queries array
-if [[ -n "$CUSTOM_QUERY" ]]; then
- QUERIES=("$CUSTOM_QUERY")
-else
- QUERIES=("${DEFAULT_QUERIES[@]}")
-fi
-
-# Check if the core binary exists
-CORE_BIN="$REPO_ROOT/target/debug/openhuman-core"
-if [[ ! -x "$CORE_BIN" ]]; then
- echo "Building openhuman-core..."
- cargo build --manifest-path "$REPO_ROOT/Cargo.toml" --bin openhuman-core 2>&1 | tail -3
- echo ""
-fi
-
-# Results storage
-RESULTS_DIR="$REPO_ROOT/target/bench-memory"
-mkdir -p "$RESULTS_DIR"
-TIMESTAMP=$(date +%Y%m%d-%H%M%S)
-RESULTS_FILE="$RESULTS_DIR/bench-$TIMESTAMP.jsonl"
-
-echo "----------------------------------------------"
-echo " Running ${#QUERIES[@]} queries"
-echo "----------------------------------------------"
-echo ""
-
-TOTAL_START=$(date +%s%N 2>/dev/null || python3 -c "import time; print(int(time.time()*1e9))")
-PASS=0
-FAIL=0
-
-for i in "${!QUERIES[@]}"; do
- query="${QUERIES[$i]}"
- idx=$((i + 1))
- echo "[$idx/${#QUERIES[@]}] $query"
-
- QUERY_START=$(date +%s%N 2>/dev/null || python3 -c "import time; print(int(time.time()*1e9))")
-
- # Call the core CLI with the memory_smart_walk RPC
- # Use python3 to safely build the JSON payload and avoid query injection
- RPC_PAYLOAD=$(python3 -c "
-import json, sys
-payload = {
- 'jsonrpc': '2.0',
- 'id': 'bench-$idx',
- 'method': 'openhuman.memory_smart_walk',
- 'params': {
- 'query': sys.argv[1],
- 'namespace': sys.argv[2],
- 'max_turns': $MAX_TURNS
- }
-}
-print(json.dumps(payload))
-" "$query" "$NAMESPACE")
-
- # Use the CLI's rpc subcommand if available, otherwise use the tool directly
- if [[ $VERBOSE -eq 1 ]]; then
- OUTPUT=$("$CORE_BIN" rpc --stdin <<< "$RPC_PAYLOAD" 2>&1) || true
- echo "$OUTPUT"
- else
- OUTPUT=$("$CORE_BIN" rpc --stdin <<< "$RPC_PAYLOAD" 2>/dev/null) || true
- fi
-
- QUERY_END=$(date +%s%N 2>/dev/null || python3 -c "import time; print(int(time.time()*1e9))")
- ELAPSED_MS=$(( (QUERY_END - QUERY_START) / 1000000 ))
-
- if echo "$OUTPUT" | grep -q '"result"'; then
- PASS=$((PASS + 1))
- STATUS="OK"
- else
- FAIL=$((FAIL + 1))
- STATUS="FAIL"
- fi
-
- echo " -> ${STATUS} in ${ELAPSED_MS}ms"
-
- # Log to JSONL — use python3 to safely encode the query string
- python3 -c "
-import json, sys
-record = {
- 'query': sys.argv[1],
- 'elapsed_ms': $ELAPSED_MS,
- 'status': sys.argv[2],
- 'timestamp': sys.argv[3]
-}
-print(json.dumps(record))
-" "$query" "$STATUS" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$RESULTS_FILE"
- echo ""
-done
-
-TOTAL_END=$(date +%s%N 2>/dev/null || python3 -c "import time; print(int(time.time()*1e9))")
-TOTAL_MS=$(( (TOTAL_END - TOTAL_START) / 1000000 ))
-
-echo "=============================================="
-echo " Summary"
-echo "=============================================="
-echo ""
-echo "Total queries: ${#QUERIES[@]}"
-echo "Passed: $PASS"
-echo "Failed: $FAIL"
-echo "Total time: ${TOTAL_MS}ms"
-echo "Results saved to: $RESULTS_FILE"
-echo ""
-
-if [[ $FAIL -gt 0 ]]; then
- echo "WARNING: $FAIL queries failed. Run with --verbose to see errors."
- exit 1
-fi
diff --git a/scripts/debug-notion-sync-memory.sh b/scripts/debug-notion-sync-memory.sh
deleted file mode 100755
index 8b8c152d5f..0000000000
--- a/scripts/debug-notion-sync-memory.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env bash
-#
-# debug-notion-sync-memory.sh — Run the Notion live test with memory verification.
-#
-# Tests the full flow: skill start → sync → memory persistence → verify documents
-#
-# Prerequisites:
-# - .env with BACKEND_URL, JWT_TOKEN, CREDENTIAL_ID, SKILLS_DATA_DIR
-# - OAuth credential at $SKILLS_DATA_DIR/notion/oauth_credential.json
-# - openhuman-skills repo available (auto-detected or via SKILL_DEBUG_DIR)
-#
-# Usage:
-# bash scripts/debug-notion-sync-memory.sh
-#
-# Environment variables (set in .env or export before running):
-# BACKEND_URL — backend API URL (e.g. https://staging-api.alphahuman.xyz)
-# JWT_TOKEN — session JWT for OAuth proxy
-# CREDENTIAL_ID — OAuth credential ID for the proxy
-# SKILLS_DATA_DIR — path to skills data dir (contains notion/ subdir)
-# RUST_LOG — Rust log filter (default: info)
-#
-set -euo pipefail
-
-SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
-REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
-
-# Load .env
-if [ -f "$REPO_ROOT/.env" ]; then
- source "$SCRIPT_DIR/load-dotenv.sh" "$REPO_ROOT/.env"
-fi
-
-export RUN_LIVE_NOTION=1
-export RUST_LOG="${RUST_LOG:-info}"
-
-echo "========================================"
-echo " Notion Sync + Memory Verification"
-echo "========================================"
-echo " BACKEND_URL: ${BACKEND_URL:-<not set>}"
-echo " JWT_TOKEN: ${JWT_TOKEN:+<set, ${#JWT_TOKEN} bytes>}"
-echo " CREDENTIAL_ID: ${CREDENTIAL_ID:-<not set>}"
-echo " SKILLS_DATA_DIR: ${SKILLS_DATA_DIR:-<not set>}"
-echo " RUST_LOG: ${RUST_LOG}"
-echo ""
-
-# Verify required vars
-for var in BACKEND_URL JWT_TOKEN CREDENTIAL_ID SKILLS_DATA_DIR; do
- if [ -z "${!var:-}" ]; then
- echo "ERROR: $var is not set. Add it to .env or export it."
- exit 1
- fi
-done
-
-# Verify OAuth credential exists
-CRED_FILE="$SKILLS_DATA_DIR/notion/oauth_credential.json"
-if [ -f "$CRED_FILE" ]; then
- echo " OAuth credential: present ($(wc -c < "$CRED_FILE" | tr -d ' ') bytes)"
-else
- echo " WARNING: $CRED_FILE not found"
- echo " The skill will start without OAuth — API calls will fail"
-fi
-echo ""
-
-cd "$REPO_ROOT"
-
-echo "--- Running Notion live test with memory verification ---"
-echo ""
-
-cargo test --test skills_notion_live -- --nocapture notion_live_with_real_data 2>&1
-
-echo ""
-echo "========================================"
-echo " DONE"
-echo "========================================"
diff --git a/scripts/memory-tree-progress.sh b/scripts/memory-tree-progress.sh
deleted file mode 100755
index 2ede11b800..0000000000
--- a/scripts/memory-tree-progress.sh
+++ /dev/null
@@ -1,207 +0,0 @@
-#!/usr/bin/env bash
-#
-# memory-tree-progress.sh — live progress monitor for the memory_tree pipeline.
-#
-# Polls the workspace SQLite DB and prints a one-line snapshot every INTERVAL
-# seconds: extract jobs done/pending, summaries per level, the currently
-# claimed job (if any), recent throughput, and a rolling cloud-LLM round-trip
-# estimate scraped from the core log. Exits cleanly when there is nothing left
-# to do (no `ready`/`running` jobs other than the daily digest dedupe).
-#
-# Optionally triggers a fresh `flush_now` first so the seal cascade picks up
-# whatever is currently buffered without waiting for the 50k-token threshold.
-#
-# Usage:
-# scripts/memory-tree-progress.sh # monitor only
-# scripts/memory-tree-progress.sh --flush # flush_now then monitor
-# scripts/memory-tree-progress.sh --interval 10 # change tick (default 5s)
-# scripts/memory-tree-progress.sh --log /tmp/x.log # override log path
-# scripts/memory-tree-progress.sh --once # one snapshot, then exit
-#
-# Env:
-# OPENHUMAN_WORKSPACE — workspace dir (default: derive from active_user.toml)
-# CORE_BIN — path to openhuman-core (default: target/debug/openhuman-core)
-# CORE_LOG — core log to scrape for round-trip times (default: /tmp/oh-core.log)
-#
-set -euo pipefail
-
-SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
-REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
-cd "$REPO_ROOT"
-
-INTERVAL=5
-DO_FLUSH=0
-ONCE=0
-CORE_BIN="${CORE_BIN:-target/debug/openhuman-core}"
-CORE_LOG="${CORE_LOG:-/tmp/oh-core.log}"
-
-while [ $# -gt 0 ]; do
- case "$1" in
- --flush) DO_FLUSH=1; shift ;;
- --interval)
- [ $# -ge 2 ] || { echo "--interval requires a value (seconds)" >&2; exit 2; }
- [[ "$2" =~ ^[1-9][0-9]*$ ]] || { echo "--interval must be a positive integer" >&2; exit 2; }
- INTERVAL="$2"; shift 2 ;;
- --log)
- [ $# -ge 2 ] || { echo "--log requires a file path" >&2; exit 2; }
- CORE_LOG="$2"; shift 2 ;;
- --once) ONCE=1; shift ;;
- -h|--help) sed -n '2,25p' "$0"; exit 0 ;;
- *) echo "unknown arg: $1" >&2; exit 2 ;;
- esac
-done
-
-# ── Resolve workspace + DB path ─────────────────────────────────────────────
-
-if [ -z "${OPENHUMAN_WORKSPACE:-}" ]; then
- DEFAULT_DIR="$HOME/.openhuman-staging"
- [ -d "$DEFAULT_DIR" ] || DEFAULT_DIR="$HOME/.openhuman"
- ACTIVE_USER_FILE="$DEFAULT_DIR/active_user.toml"
- if [ -f "$ACTIVE_USER_FILE" ]; then
- USER_ID=$(awk -F'"' '/user_id/ {print $2; exit}' "$ACTIVE_USER_FILE")
- OPENHUMAN_WORKSPACE="$DEFAULT_DIR/users/$USER_ID/workspace"
- fi
-fi
-DB="${OPENHUMAN_WORKSPACE:-}/memory_tree/chunks.db"
-if [ ! -f "$DB" ]; then
- echo "memory_tree DB not found at: $DB" >&2
- echo "Set OPENHUMAN_WORKSPACE to override." >&2
- exit 1
-fi
-
-echo "workspace: $OPENHUMAN_WORKSPACE"
-echo "db: $DB"
-echo "log: $CORE_LOG"
-echo
-
-# ── Optional initial flush ──────────────────────────────────────────────────
-
-if [ "$DO_FLUSH" = 1 ]; then
- if [ ! -x "$CORE_BIN" ]; then
- echo "core binary not found: $CORE_BIN — build with 'cargo build --bin openhuman-core'" >&2
- exit 1
- fi
- echo "→ triggering memory_tree.flush_now"
- # Capture the full output so we can echo it on failure (the call's
- # exit code is what we gate on; the grep below is just for the
- # success-path summary).
- flush_out="$("$CORE_BIN" call --method openhuman.memory_tree_flush_now --params '{}' 2>&1)" || {
- echo "$flush_out" >&2
- echo "flush_now failed; aborting monitor start." >&2
- exit 1
- }
- echo "$flush_out" | grep -E '"enqueued"|"stale_buffers"|memory_tree::read' || true
- echo
-fi
-
-# ── Snapshot helper ─────────────────────────────────────────────────────────
-
-q() { sqlite3 "$DB" "$@"; }
-
-# Track previous done counts so we can show throughput per tick.
-PREV_EXTRACT_DONE=0
-PREV_SUMMARIES=0
-START_TS=$(date +%s)
-
-snapshot() {
- local now ts ext_done ext_ready ext_run sums_l1 sums_l2 sums_l3 sums_l0 \
- chunks_pending chunks_admitted chunks_buffered \
- running_kind running_started_ms running_age_s \
- rt_recent_avg eta_min
-
- now=$(date +%s)
- ts=$(date '+%H:%M:%S')
-
- ext_done=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_jobs WHERE kind='extract_chunk' AND status='done';")
- ext_ready=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_jobs WHERE kind='extract_chunk' AND status='ready';")
- ext_run=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_jobs WHERE kind='extract_chunk' AND status='running';")
-
- sums_l0=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_summaries WHERE level=0;")
- sums_l1=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_summaries WHERE level=1;")
- sums_l2=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_summaries WHERE level=2;")
- sums_l3=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_summaries WHERE level>=3;")
-
- chunks_pending=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_chunks WHERE lifecycle_status='pending_extraction';")
- chunks_admitted=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_chunks WHERE lifecycle_status='admitted';")
- chunks_buffered=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_chunks WHERE lifecycle_status='buffered';")
-
- # Currently-claimed work (any kind), with age in seconds.
- local now_ms; now_ms=$((now * 1000))
- running_row=$(q "SELECT kind, COALESCE(started_at_ms,0) FROM mem_tree_jobs WHERE status='running' ORDER BY started_at_ms ASC LIMIT 1;")
- if [ -n "$running_row" ]; then
- running_kind=$(echo "$running_row" | cut -d'|' -f1)
- running_started_ms=$(echo "$running_row" | cut -d'|' -f2)
- if [ "$running_started_ms" -gt 0 ] 2>/dev/null; then
- running_age_s=$(( (now_ms - running_started_ms) / 1000 ))
- else
- running_age_s="?"
- fi
- else
- running_kind="-"
- running_age_s="-"
- fi
-
- # Throughput since last tick.
- local d_extract=$((ext_done - PREV_EXTRACT_DONE))
- local d_sums=$(( (sums_l0 + sums_l1 + sums_l2 + sums_l3) - PREV_SUMMARIES ))
- PREV_EXTRACT_DONE=$ext_done
- PREV_SUMMARIES=$((sums_l0 + sums_l1 + sums_l2 + sums_l3))
-
- # Rolling round-trip estimate from the last few cloud responses.
- rt_recent_avg="?"
- if [ -f "$CORE_LOG" ]; then
- rt_recent_avg=$(awk '
- /\[memory_tree::chat::cloud\] kind=/ {
- split($1, a, ":"); start = a[1]*3600 + a[2]*60 + a[3]
- }
- /\[memory_tree::chat::cloud\] response/ {
- split($1, a, ":"); end = a[1]*3600 + a[2]*60 + a[3]
- if (start > 0) { sum += (end - start); n++ }
- }
- END { if (n>0) printf "%.1fs", sum/n; else printf "?" }
- ' "$CORE_LOG" | tail -c 16)
- fi
-
- eta_min="?"
- if [ "$d_extract" -gt 0 ] 2>/dev/null; then
- # ETA based on jobs/tick * INTERVAL seconds.
- local secs_per=$(( INTERVAL / d_extract ))
- [ "$secs_per" -lt 1 ] && secs_per=1
- eta_min=$(( ext_ready * secs_per / 60 ))m
- fi
-
- # NOTE: source-tree leaves are L1+ (raw chunks are the L0 leaves of the
- # tree but aren't represented in `mem_tree_summaries`); the L0 row in
- # `mem_tree_summaries` is only populated by global-tree daily digests.
- # We surface it here as `digest=` so the bucket name doesn't mislead.
- printf "%s extract: done=%d pending=%d run=%d (+%d/tick eta~%s) summaries L1=%d L2=%d L3+=%d digest=%d (+%d) chunks: pend=%d adm=%d buf=%d running=%s/%ss cloud_avg=%s\n" \
- "$ts" "$ext_done" "$ext_ready" "$ext_run" "$d_extract" "$eta_min" \
- "$sums_l1" "$sums_l2" "$sums_l3" "$sums_l0" "$d_sums" \
- "$chunks_pending" "$chunks_admitted" "$chunks_buffered" \
- "$running_kind" "$running_age_s" "$rt_recent_avg"
-
- # Done-condition: nothing pending or running across all kinds (digest_daily
- # rows are dedupe-suppressed steady state, ignore them).
- local active_other
- active_other=$(q "SELECT COALESCE(COUNT(*),0) FROM mem_tree_jobs \
- WHERE status IN ('ready','running') \
- AND kind <> 'digest_daily';")
- [ "$active_other" = "0" ]
-}
-
-# ── Loop ────────────────────────────────────────────────────────────────────
-
-if [ "$ONCE" = 1 ]; then
- snapshot || true
- exit 0
-fi
-
-trap 'echo; echo "interrupted."; exit 0' INT
-
-while true; do
- if snapshot; then
- echo "→ pipeline idle (no ready/running jobs). exiting."
- exit 0
- fi
- sleep "$INTERVAL"
-done
diff --git a/scripts/regen-memory-golden-fixture.sh b/scripts/regen-memory-golden-fixture.sh
deleted file mode 100755
index e34908efaf..0000000000
--- a/scripts/regen-memory-golden-fixture.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/env bash
-#
-# Regenerate the committed golden memory-workspace fixture.
-#
-# tests/fixtures/memory_golden/workspace/**.db the captured workspace
-# tests/fixtures/memory_golden/manifest.txt schema manifest DERIVED from it
-#
-# Both are produced together by the `#[ignore]`d `regenerate_golden_fixture`
-# test in `tests/memory_golden_fixture_e2e.rs`, driven by the CURRENT build.
-#
-# ── When to run this ─────────────────────────────────────────────────────────
-#
-# Only when you are deliberately changing the memory store's on-disk schema,
-# and only alongside a migration for existing user workspaces. Regenerating
-# the fixture is how you re-baseline the gate; it is NOT how you fix a
-# failing test. If `memory_golden_fixture_e2e` failed and you did not intend
-# a schema change, the failure is the bug.
-#
-# ── The ordering rule this script exists to protect ──────────────────────────
-#
-# The manifest is never hand-written: it is dumped from the fixture DB files.
-# So editing a `CREATE TABLE` and editing `manifest.txt` to match still fails,
-# because the committed `.db` was written by the older binary. Getting back to
-# green requires running THIS script, which rewrites the binary blobs — a
-# change a reviewer can see.
-#
-# Usage:
-# scripts/regen-memory-golden-fixture.sh
-#
-set -euo pipefail
-
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
-cd "$REPO_ROOT"
-
-FIXTURE_DIR="tests/fixtures/memory_golden"
-README="$FIXTURE_DIR/README.md"
-
-echo "[golden-fixture] regenerating from the current build"
-SOURCE_SHA="$(git rev-parse HEAD)"
-if ! git diff --quiet -- crates/openhuman-core/src/memory; then
- echo "[golden-fixture] WARNING: crates/openhuman-core/src/memory has uncommitted changes." >&2
- echo "[golden-fixture] The fixture will capture the WORKING TREE, but the" >&2
- echo "[golden-fixture] README will record ${SOURCE_SHA}. Commit first." >&2
-fi
-
-GGML_NATIVE="${GGML_NATIVE:-OFF}" cargo test \
- --manifest-path Cargo.toml \
- --test memory_golden_fixture_e2e \
- regenerate_golden_fixture -- --exact --ignored --nocapture
-
-# Record provenance next to the blobs. The SHA is the whole point: it is what
-# makes "this fixture predates the change under review" checkable.
-cat > "$README" <<EOF
-# Golden memory-workspace fixture
-
-**Generated — do not hand-edit.** Regenerate with
-\`scripts/regen-memory-golden-fixture.sh\`.
-
-| | |
-| --- | --- |
-| Captured at commit | \`${SOURCE_SHA}\` |
-| Captured on | $(date -u +"%Y-%m-%dT%H:%M:%SZ") |
-| Generator | \`regenerate_golden_fixture\` in \`tests/memory_golden_fixture_e2e.rs\` |
-| Seeder | \`openhuman_core::memory::store::golden::seed\` |
-
-## Contents
-
-\`workspace/**.db\` is a real memory workspace seeded through production write
-paths and then \`VACUUM\`ed with \`PRAGMA wal_checkpoint(TRUNCATE)\`, so each
-file is self-contained (no \`-wal\` / \`-shm\` siblings). It holds:
-
-- documents in two namespaces (\`golden-primary\`, \`golden-secondary\`)
-- both KV scopes (global and namespace)
-- a graph triple
-- an episodic row (which materialises the \`episodic_fts\` shadow tables and
- the sync triggers)
-- a sealed, summarised conversation segment with both embedding tiers
-- an event row (materialising \`event_fts\`) with a per-model embedding
-- a \`user_profile\` facet
-- a tinycortex leaf chunk with an embedding, and a summary tree sealed to an
- L1 summary node with its own embedding
-
-\`manifest.txt\` is **derived from those DB files**, never written by hand.
-
-## Why this is committed as a binary
-
-\`.gitattributes\` marks \`tests/fixtures/memory_golden/**/*.db binary\`. Without
-it the repo-wide \`* text=auto eol=lf\` rule would rewrite byte sequences inside
-the blobs on checkout and corrupt them.
-
-## Reviewing a change to this directory
-
-A diff that touches this directory is a **schema-migration review**, not a
-test-data refresh. Ask for the migration that carries existing user workspaces
-across, and check that the manifest diff matches the DDL diff.
-EOF
-
-echo "[golden-fixture] wrote $README (source SHA ${SOURCE_SHA})"
-echo "[golden-fixture] fixture size:"
-du -sh "$FIXTURE_DIR"
-git status --short -- "$FIXTURE_DIR"
diff --git a/scripts/test-memory-email-ingest.mjs b/scripts/test-memory-email-ingest.mjs
deleted file mode 100644
index 7dff0f59de..0000000000
--- a/scripts/test-memory-email-ingest.mjs
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/usr/bin/env node
-// Phase 1 (data collection & standardization) — drive the memory layer with
-// emails fetched from Composio's GMAIL_FETCH_EMAILS action.
-//
-// Inputs:
-// - A JSON file with the slim post-processed shape produced by
-// `crates/openhuman-core/src/memory/sync/composio/providers/gmail/post_process.rs`. Each entry
-// under `messages[]` looks like:
-// { id, threadId, subject, from, to, date, labels, markdown, attachments }
-// Default fixture: tests/fixtures/memory/composio_gmail_inbox.json
-//
-// Behaviour:
-// - Groups messages by `threadId` so a single ingest call covers a whole
-// email thread (this is what the canonicaliser expects — one
-// EmailThread per source_id).
-// - For each thread calls `openhuman.memory_tree_ingest` with
-// source_kind=email + an EmailThread payload (see
-// crates/openhuman-core/src/memory/tree/canonicalize/email.rs).
-// - Verifies via `openhuman.memory_tree_list_chunks` that chunks landed.
-//
-// Pre-reqs: the core server must already be serving JSON-RPC on $RPC_URL
-// (default http://127.0.0.1:7810/rpc). Start it with:
-//
-// cargo run --bin openhuman -- serve
-//
-// Usage:
-// node scripts/test-memory-email-ingest.mjs [path/to/inbox.json]
-//
-// Env:
-// RPC_URL override the JSON-RPC endpoint
-// OWNER owner string stamped on every chunk (default: [email protected])
-// PROVIDER provider tag emitted in EmailThread.provider (default: gmail)
-
-import { readFile } from "node:fs/promises";
-import { resolve } from "node:path";
-import process from "node:process";
-
-const RPC_URL = process.env.RPC_URL || "http://127.0.0.1:7810/rpc";
-const OWNER = process.env.OWNER || "[email protected]";
-const PROVIDER = process.env.PROVIDER || "gmail";
-const FIXTURE =
- process.argv[2] ||
- resolve("tests/fixtures/memory/composio_gmail_inbox.json");
-
-let rpcId = 0;
-async function rpc(method, params) {
- rpcId += 1;
- const res = await fetch(RPC_URL, {
- method: "POST",
- headers: { "content-type": "application/json" },
- body: JSON.stringify({ jsonrpc: "2.0", id: rpcId, method, params }),
- });
- if (!res.ok) throw new Error(`${method}: HTTP ${res.status} ${await res.text()}`);
- const body = await res.json();
- if (body.error) {
- throw new Error(`${method}: ${body.error.message || JSON.stringify(body.error)}`);
- }
- return body.result;
-}
-
-function parseEmailDate(raw) {
- if (!raw) return Date.now();
- if (typeof raw === "number") return raw < 1e12 ? raw * 1000 : raw;
- const ms = Date.parse(raw);
- return Number.isFinite(ms) ? ms : Date.now();
-}
-
-function splitAddresses(value) {
- if (!value) return [];
- if (Array.isArray(value)) return value.filter(Boolean);
- return String(value)
- .split(/[;,]/)
- .map((s) => s.trim())
- .filter(Boolean);
-}
-
-function toEmailMessage(slim) {
- return {
- from: slim.from || "unknown@unknown",
- to: splitAddresses(slim.to),
- cc: splitAddresses(slim.cc),
- subject: slim.subject || "(no subject)",
- sent_at: parseEmailDate(slim.date),
- body: slim.markdown || "",
- source_ref: slim.id ? `gmail://message/${slim.id}` : null,
- };
-}
-
-function groupByThread(messages) {
- const threads = new Map();
- for (const m of messages) {
- const tid = m.threadId || m.id || "unknown-thread";
- if (!threads.has(tid)) threads.set(tid, []);
- threads.get(tid).push(m);
- }
- return [...threads.entries()].map(([threadId, msgs]) => {
- msgs.sort((a, b) => parseEmailDate(a.date) - parseEmailDate(b.date));
- return {
- threadId,
- subject: msgs[0]?.subject || "(no subject)",
- messages: msgs.map(toEmailMessage),
- };
- });
-}
-
-async function main() {
- console.log(`[memory-email-ingest] fixture=${FIXTURE}`);
- console.log(`[memory-email-ingest] rpc_url=${RPC_URL}`);
-
- // Sanity-check that the core is up.
- await rpc("openhuman.health_snapshot", {}).catch((err) => {
- throw new Error(
- `core not reachable at ${RPC_URL} — start it with \`cargo run --bin openhuman -- serve\`. (${err.message})`,
- );
- });
-
- const raw = await readFile(FIXTURE, "utf8");
- const inbox = JSON.parse(raw);
- const messages = Array.isArray(inbox.messages) ? inbox.messages : [];
- if (messages.length === 0) {
- console.error("[memory-email-ingest] no messages in fixture, nothing to do");
- process.exit(1);
- }
- console.log(`[memory-email-ingest] loaded ${messages.length} email(s)`);
-
- const threads = groupByThread(messages);
- console.log(`[memory-email-ingest] grouped into ${threads.length} thread(s)`);
-
- let chunksWritten = 0;
- let chunksDropped = 0;
- for (const t of threads) {
- const sourceId = `gmail:${t.threadId}`;
- const params = {
- source_kind: "email",
- source_id: sourceId,
- owner: OWNER,
- tags: ["gmail", "ingested", "phase1"],
- payload: {
- provider: PROVIDER,
- thread_subject: t.subject,
- messages: t.messages,
- },
- };
- process.stdout.write(
- ` · ${sourceId} (${t.messages.length} msg, subject="${t.subject.slice(0, 60)}") … `,
- );
- try {
- const result = await rpc("openhuman.memory_tree_ingest", params);
- const r = result?.result || result || {};
- chunksWritten += r.chunks_written || 0;
- chunksDropped += r.chunks_dropped || 0;
- console.log(
- `ok written=${r.chunks_written ?? 0} dropped=${r.chunks_dropped ?? 0}`,
- );
- } catch (err) {
- console.log(`FAIL ${err.message}`);
- }
- }
-
- console.log(
- `[memory-email-ingest] summary: threads=${threads.length} chunks_written=${chunksWritten} chunks_dropped=${chunksDropped}`,
- );
-
- // Quick verification — pull email chunks back out and print a count.
- const list = await rpc("openhuman.memory_tree_list_chunks", {
- source_kind: "email",
- owner: OWNER,
- limit: 100,
- });
- const chunks = list?.result?.chunks || list?.chunks || [];
- console.log(
- `[memory-email-ingest] verify: list_chunks(source_kind=email, owner=${OWNER}) returned ${chunks.length} chunk(s)`,
- );
- for (const c of chunks.slice(0, 5)) {
- const ts = c.metadata?.timestamp
- ? new Date(c.metadata.timestamp).toISOString()
- : "?";
- const preview = (c.content || "").replace(/\s+/g, " ").slice(0, 80);
- console.log(` - ${c.id} ${c.metadata?.source_id} ${ts} ${preview}`);
- }
-}
-
-main().catch((err) => {
- console.error(`[memory-email-ingest] fatal: ${err.message}`);
- process.exit(1);
-});
diff --git a/scripts/tree-summarizer-run-all.sh b/scripts/tree-summarizer-run-all.sh
deleted file mode 100755
index 6ed05af3c6..0000000000
--- a/scripts/tree-summarizer-run-all.sh
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/usr/bin/env bash
-# tree-summarizer-run-all.sh — Run tree summarization for every memory namespace.
-#
-# Discovers namespaces by listing directories under the workspace's
-# memory/namespaces/ folder, then runs the tree-summarizer for each one.
-#
-# Usage:
-# bash scripts/tree-summarizer-run-all.sh # run (drain buffer + summarize)
-# bash scripts/tree-summarizer-run-all.sh status # show status for all trees
-# bash scripts/tree-summarizer-run-all.sh query [node_id] # query all trees
-# bash scripts/tree-summarizer-run-all.sh rebuild # rebuild all trees from leaves
-#
-# Options:
-# -v, --verbose Enable debug logging
-# --workspace DIR Override OPENHUMAN_WORKSPACE
-# --binary PATH Override the openhuman-core binary path
-
-set -euo pipefail
-
-# ── Defaults ───────────────────────────────────────────────────────────
-
-SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
-REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
-
-VERBOSE=""
-SUBCOMMAND="run"
-NODE_ID=""
-
-# Resolve binary: staged sidecar → debug build → release build
-resolve_binary() {
- local arch
- arch="$(uname -m)"
- case "$arch" in
- arm64|aarch64) arch="aarch64-apple-darwin" ;;
- x86_64) arch="x86_64-apple-darwin" ;;
- *) arch="$arch-unknown-linux-gnu" ;;
- esac
-
- for bin in \
- "$REPO_ROOT/crates/openhuman-app/binaries/openhuman-core-$arch" \
- "$REPO_ROOT/target/debug/openhuman-core" \
- "$REPO_ROOT/target/release/openhuman-core"; do
- if [ -x "$bin" ]; then
- echo "$bin"
- return
- fi
- done
-
- echo >&2 "error: could not find openhuman-core binary. Build with: cargo build --bin openhuman-core"
- exit 1
-}
-
-OPENHUMAN_BIN="${OPENHUMAN_BIN:-$(resolve_binary)}"
-
-# Resolve workspace: env var → active user → first user dir
-resolve_workspace() {
- if [ -n "${OPENHUMAN_WORKSPACE:-}" ]; then
- echo "$OPENHUMAN_WORKSPACE"
- return
- fi
-
- # Try the active user workspace
- local active_user_file="$HOME/.openhuman/active_user.toml"
- if [ -f "$active_user_file" ]; then
- local user_id
- user_id=$(sed -n 's/^user_id *= *"\([^"]*\)".*/\1/p' "$active_user_file" 2>/dev/null || true)
- if [ -n "$user_id" ] && [ -d "$HOME/.openhuman/users/$user_id/workspace" ]; then
- echo "$HOME/.openhuman/users/$user_id/workspace"
- return
- fi
- fi
-
- # Fallback: first user directory with a workspace
- for user_dir in "$HOME"/.openhuman/users/*/; do
- if [ -d "${user_dir}workspace" ]; then
- echo "${user_dir}workspace"
- return
- fi
- done
-
- echo >&2 "error: could not resolve OPENHUMAN_WORKSPACE. Set it explicitly."
- exit 1
-}
-
-export OPENHUMAN_WORKSPACE="${OPENHUMAN_WORKSPACE:-$(resolve_workspace)}"
-
-# ── Parse args ─────────────────────────────────────────────────────────
-
-while [ $# -gt 0 ]; do
- case "$1" in
- -v|--verbose)
- VERBOSE="-v"
- shift
- ;;
- --workspace)
- export OPENHUMAN_WORKSPACE="$2"
- shift 2
- ;;
- --binary)
- OPENHUMAN_BIN="$2"
- shift 2
- ;;
- run|status|query|rebuild)
- SUBCOMMAND="$1"
- shift
- # For query, grab optional node_id
- if [ "$SUBCOMMAND" = "query" ] && [ $# -gt 0 ]; then
- case "$1" in
- -*) ;; # skip flags
- *) NODE_ID="$1"; shift ;;
- esac
- fi
- ;;
- -h|--help)
- sed -n '2,/^$/{ s/^# //; s/^#$//; p }' "$0"
- exit 0
- ;;
- *)
- echo >&2 "unknown argument: $1"
- exit 1
- ;;
- esac
-done
-
-# ── Discover namespaces ────────────────────────────────────────────────
-
-NAMESPACES_DIR="$OPENHUMAN_WORKSPACE/memory/namespaces"
-
-if [ ! -d "$NAMESPACES_DIR" ]; then
- echo "No namespaces directory found at $NAMESPACES_DIR"
- exit 0
-fi
-
-NAMESPACES=$(find "$NAMESPACES_DIR" -mindepth 1 -maxdepth 1 -type d | while read -r d; do basename "$d"; done | sort)
-
-if [ -z "$NAMESPACES" ]; then
- echo "No memory namespaces found."
- exit 0
-fi
-
-NS_COUNT=$(echo "$NAMESPACES" | wc -l | tr -d ' ')
-NS_LIST=$(echo "$NAMESPACES" | tr '\n' ' ')
-
-echo "Found $NS_COUNT namespace(s): $NS_LIST"
-echo "Workspace: $OPENHUMAN_WORKSPACE"
-echo "Binary: $OPENHUMAN_BIN"
-echo "Command: tree-summarizer $SUBCOMMAND"
-echo "---"
-
-# ── Strip ASCII art banner from output ─────────────────────────────────
-
-strip_banner() {
- grep -v '▗\|▐\|▝\|▀\|█\|Contribute\|OpenHuman core' | grep -v '^[[:space:]]*$'
-}
-
-# ── Run for each namespace ─────────────────────────────────────────────
-
-FAILED=0
-SUCCEEDED=0
-
-while IFS= read -r ns; do
- echo ""
- echo "=== [$ns] ==="
-
- args=("$SUBCOMMAND" "$ns")
- if [ "$SUBCOMMAND" = "query" ] && [ -n "$NODE_ID" ]; then
- args+=("$NODE_ID")
- fi
- if [ -n "$VERBOSE" ]; then
- args+=("$VERBOSE")
- fi
-
- if output=$("$OPENHUMAN_BIN" tree-summarizer "${args[@]}" 2>&1); then
- echo "$output" | strip_banner | head -40
- SUCCEEDED=$((SUCCEEDED + 1))
- else
- echo "$output" | strip_banner | tail -5
- echo " ^^^ FAILED"
- FAILED=$((FAILED + 1))
- fi
-done <<< "$NAMESPACES"
-
-echo ""
-echo "---"
-echo "Done. $SUCCEEDED succeeded, $FAILED failed out of $NS_COUNT namespace(s)."
-
-if [ "$FAILED" -gt 0 ]; then
- exit 1
-fi