#!/bin/bash # Simple script to run the auto-memory indexer sessions_dir="/home/wdjones/.openclaw/agents/main/sessions" memory_hook="/home/wdjones/.openclaw/workspace/tools/auto-memory-hook.py" temp_file="/tmp/memory_pairs.jsonl" echo "Processing session files for memory indexing..." >&2 # Find larger session files and extract conversation pairs find "$sessions_dir" -name "*.jsonl" -type f -size +50k | head -5 | while read file; do echo "Processing $(basename "$file")..." >&2 python3 /home/wdjones/.openclaw/workspace/extract_assistant_turns.py done > "$temp_file" # Process each JSON line through the memory hook turn_count=0 while IFS= read -r json_line && [ $turn_count -lt 10 ]; do if [ -n "$json_line" ]; then echo "$json_line" | python3 "$memory_hook" 2>/dev/null if [ $? -eq 0 ]; then turn_count=$((turn_count + 1)) echo "Processed turn $turn_count" >&2 fi fi done < "$temp_file" rm -f "$temp_file" echo "Auto-memory indexer completed. Processed $turn_count turns." >&2