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:
@@ -12,22 +12,31 @@ End-of-session logging. Captures key decisions, gotchas, open questions, and pro
|
||||
/log
|
||||
```
|
||||
|
||||
No arguments. Reviews the full conversation history automatically.
|
||||
No arguments. Reviews the full conversation history and any pre-compaction transcript backups automatically.
|
||||
|
||||
## How it works
|
||||
|
||||
1. Creates `memory/log/` if needed
|
||||
2. Reviews the conversation and extracts: Summary, Decisions, Gotchas (tagged with `[topic]`), Open Questions, Key Context, Process Notes
|
||||
3. Writes a structured log file — empty sections are omitted
|
||||
4. Prunes old logs: deletes reflected logs older than `retention_days` (default 7), warns about unreflected logs older than `warn_unreflected_days` (default 14)
|
||||
3. Writes a structured in-context log — empty sections are omitted
|
||||
4. **Transcript analysis (when backups exist):** Checks `~/.claude/transcript-backups/tracking.json` for unprocessed pre-compaction snapshots for the current project. If found, spawns a **Sonnet** subagent to read the JSONL backups (via `extract-transcripts.py --extract`) and write a companion log `HHMMSS-transcripts.md`. The subagent then marks backups as processed in `tracking.json`. Sonnet is used (not Haiku) because gotcha detection requires judgment about backtracking and failed attempts.
|
||||
5. Prunes old logs: deletes reflected logs older than `retention_days` (default 7), warns about unreflected logs older than `warn_unreflected_days` (default 14)
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `~/.claude/scripts/list-transcripts-here.sh` — pre-gathers unprocessed transcript metadata (small JSON, no context overflow)
|
||||
- `~/.claude/scripts/extract-transcripts.py` — reads JSONL backups and manages tracking.json (used by the Sonnet subagent)
|
||||
- Both scripts live in `claude-foundations/scripts/`, symlinked into `~/.claude/scripts/`
|
||||
|
||||
## Part of the knowledge pipeline
|
||||
|
||||
`/log` → `/reflect-logs` → `/distill-best-practices`
|
||||
|
||||
Raw session logs are input for `/reflect-logs`, which routes entries into topic memory files.
|
||||
Raw session logs (and transcript companion logs) are input for `/reflect-logs`, which routes entries into topic memory files.
|
||||
|
||||
## Gotchas
|
||||
|
||||
- Trivial sessions can be skipped — the skill says so if nothing worth logging happened
|
||||
- `[topic]` tags on gotchas should match existing memory file topics for routing by `/reflect-logs`
|
||||
- The Sonnet subagent writes to the project's absolute `memory/log/` path; if it uses a relative path from the wrong cwd, the file ends up in the wrong place — verify on first real run
|
||||
- Pre-compaction backups from before the tracking system existed (files with `-auto` in the name) are not in `tracking.json` and won't be processed; they'll be pruned by the 30-day cleanup in the hook
|
||||
|
||||
Reference in New Issue
Block a user