Files
claude-foundations/memory/script-install-hooks.md
Paul O'Reilly 6fd0dac218 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>
2026-04-13 14:06:09 +12:00

40 lines
1.8 KiB
Markdown

# script: install-hooks
**Location:** `scripts/install-hooks.sh`
## Purpose
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
```bash
cd ~/dev/claude/projects/claude-foundations
scripts/install-hooks.sh
```
One-time setup. Re-run after adding new hooks or skill-helper scripts.
## How it works
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/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.