vestige/hooks/load-all-memory.sh
Sam Valladares d4313df759
Some checks are pending
CI / Test (macos-latest) (push) Waiting to run
CI / Test (ubuntu-latest) (push) Waiting to run
CI / Release Build (aarch64-apple-darwin) (push) Blocked by required conditions
CI / Release Build (x86_64-unknown-linux-gnu) (push) Blocked by required conditions
CI / Release Build (x86_64-apple-darwin) (push) Blocked by required conditions
Test Suite / Unit Tests (push) Waiting to run
Test Suite / MCP E2E Tests (push) Waiting to run
Test Suite / User Journey Tests (push) Blocked by required conditions
Test Suite / Dashboard Build (push) Waiting to run
Test Suite / Code Coverage (push) Waiting to run
Release v2.1.0
2026-04-27 13:20:51 -05:00

40 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
# Load ALL memory MD files on every UserPromptSubmit.
# Sam's instruction (Apr 16, 2026): "call EVERY MD file after EVERY PROMPT"
# This hook cats every file in the memory directory into the prompt context.
# Resolve per-user Claude Code project memory dir from $HOME.
# Claude Code encodes home path as `-Users-<name>`; allow override via env.
if [ -n "${VESTIGE_MEMORY_DIR:-}" ]; then
MEM_DIR="$VESTIGE_MEMORY_DIR"
else
MEM_DIR="$HOME/.claude/projects/$(printf '%s' "$HOME" | tr '/' '-')/memory"
fi
if [ ! -d "$MEM_DIR" ]; then
exit 0
fi
echo "═══════════════════════════════════════════════════════════════"
echo "[FULL MEMORY DUMP — EVERY FILE LOADED PER SAM'S INSTRUCTION]"
echo "Sam said: 'call EVERY MD file after EVERY PROMPT' (Apr 16, 2026)"
echo "═══════════════════════════════════════════════════════════════"
echo ""
# Iterate every .md file in the memory directory (not archive)
for f in "$MEM_DIR"/*.md; do
if [ -f "$f" ]; then
filename=$(basename "$f")
echo ""
echo "┌─────────────────────────────────────────────────────────────"
echo "│ FILE: $filename"
echo "└─────────────────────────────────────────────────────────────"
cat "$f"
echo ""
fi
done
echo ""
echo "═══════════════════════════════════════════════════════════════"
echo "[END FULL MEMORY DUMP — $(ls "$MEM_DIR"/*.md 2>/dev/null | wc -l | tr -d ' ') files loaded]"
echo "═══════════════════════════════════════════════════════════════"