Add transcript backup tracking system and pre-compact hook improvements

- pre-compact-backup.sh: derive transcript path from session_id+cwd (no
  longer relies on transcript_path field that Claude Code stopped providing);
  register each backup in tracking.json after saving
- extract-transcripts.py: new script managing tracking.json — register,
  list, extract conversation text, mark-processed modes
- list-transcripts-here.sh: thin wrapper for extract-transcripts --list
  using $(pwd); needed because SKILL.md bang commands reject $() substitution
- install-hooks.sh: now also symlinks skill-helper scripts into
  ~/.claude/scripts/ via a curated SKILL_HELPERS list
- Memory docs: new script-extract-transcripts.md, script-list-transcripts-here.md;
  updated skill-log.md, script-install-hooks.md, MEMORY.md index

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul O'Reilly
2026-04-13 14:06:09 +12:00
parent 52b0f2b5c6
commit 6fd0dac218
9 changed files with 439 additions and 24 deletions

View File

@@ -1,26 +1,49 @@
#!/usr/bin/env bash
# Symlink all hooks from claude-foundations/hooks/ into ~/.claude/hooks/
# and print the settings.json configuration to add.
# Symlink all hooks from claude-foundations/hooks/ into ~/.claude/hooks/,
# and symlink skill-helper scripts from claude-foundations/scripts/ into ~/.claude/scripts/.
# Prints the settings.json configuration to add for hooks.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
HOOKS_SRC="$(cd "$SCRIPT_DIR/../hooks" && pwd)"
HOOKS_DST="$HOME/.claude/hooks"
SCRIPTS_DST="$HOME/.claude/scripts"
# ---------------------------------------------------------------------------
# Hooks
# ---------------------------------------------------------------------------
mkdir -p "$HOOKS_DST"
echo "Installing hooks from $HOOKS_SRC$HOOKS_DST"
echo ""
echo "Installing hooks: $HOOKS_SRC$HOOKS_DST"
for HOOK in "$HOOKS_SRC"/*.sh; do
NAME="$(basename "$HOOK")"
ln -sf "$HOOK" "$HOOKS_DST/$NAME"
echo "$NAME"
done
# ---------------------------------------------------------------------------
# Skill-helper scripts (scripts that skills reference via ~/.claude/scripts/)
# Not all claude-foundations scripts go here — only the ones used by skills.
# ---------------------------------------------------------------------------
mkdir -p "$SCRIPTS_DST"
echo ""
echo "Hooks symlinked. Ensure your ~/.claude/settings.json includes:"
echo "Installing skill-helper scripts: $SCRIPT_DIR$SCRIPTS_DST"
SKILL_HELPERS=(
"extract-transcripts.py"
"list-transcripts-here.sh"
)
for SCRIPT in "${SKILL_HELPERS[@]}"; do
SRC="$SCRIPT_DIR/$SCRIPT"
if [ -f "$SRC" ]; then
ln -sf "$SRC" "$SCRIPTS_DST/$SCRIPT"
echo "$SCRIPT"
else
echo "$SCRIPT (not found at $SRC)"
fi
done
echo ""
echo "Done. Ensure your ~/.claude/settings.json (and profile settings.json files) include:"
echo ""
cat <<'EOF'
{
@@ -50,3 +73,6 @@ cat <<'EOF'
}
}
EOF
echo ""
echo "Note: hooks are referenced as ~/.claude/hooks/ (default profile path) in all profile settings.json files."
echo "Note: skill-helper scripts are installed to ~/.claude/scripts/ only — profiles reference this shared path."