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

@@ -4,7 +4,7 @@
## Purpose
Symlinks all hook scripts from `claude-foundations/hooks/` into `~/.claude/hooks/` and prints the `settings.json` configuration to add.
Symlinks all hook scripts from `claude-foundations/hooks/` into `~/.claude/hooks/`, and symlinks skill-helper scripts from `claude-foundations/scripts/` into `~/.claude/scripts/`. Also prints the `settings.json` configuration to add.
## Usage
@@ -13,15 +13,27 @@ cd ~/dev/claude/projects/claude-foundations
scripts/install-hooks.sh
```
One-time setup. Re-run after adding new hooks.
One-time setup. Re-run after adding new hooks or skill-helper scripts.
## How it works
1. Iterates over `hooks/*.sh`
2. Creates symlinks in `~/.claude/hooks/` (force-overwrites existing)
1. Iterates over `hooks/*.sh`, creates symlinks in `~/.claude/hooks/` (force-overwrites)
2. Iterates over a curated list of skill-helper scripts, creates symlinks in `~/.claude/scripts/`
3. Prints the JSON config for `~/.claude/settings.json` covering PreCompact, PostToolUse, and PreToolUse matchers
## Skill-helper scripts vs regular scripts
Not all `claude-foundations/scripts/` go into `~/.claude/scripts/`. Only scripts that skills reference via `~/.claude/scripts/` are installed there. The `SKILL_HELPERS` array in `install-hooks.sh` is the authoritative list. Currently: `extract-transcripts.py`, `list-transcripts-here.sh`.
Regular scripts (`statusline.sh`, `set-topic.sh`, etc.) are accessed via their full path in `claude-foundations/scripts/`.
## Profile notes
- Hooks: `~/.claude/hooks/` is referenced in all profile `settings.json` files — install once, works everywhere
- Scripts: `~/.claude/scripts/` is the only location skills reference — no per-profile script dirs needed
## Gotchas
- The printed JSON must be manually added to `settings.json` — the script doesn't edit it automatically.
- Symlinks mean the hook code stays in the repo; updates take effect immediately without re-running the script.
- Symlinks mean the hook/script code stays in the repo; updates take effect immediately without re-running the script.
- Adding a new skill-helper script requires updating the `SKILL_HELPERS` array in `install-hooks.sh` and re-running it.