feat: save full conversation transcript on Claude compaction#105
Merged
Conversation
Leverage Claude Code's PreCompact hook to save the complete conversation transcript to our database before compaction occurs. This provides: - Persistent backup that survives Claude's session cleanup (cleanupPeriodDays) - Full audit trail for debugging and analysis - Source for future re-summarization if needed - Recovery option for tasks that resume weeks/months later Implementation: - Add PreCompact hook to setupClaudeHooks in executor.go - Create handlePreCompactHook to save transcript on compaction events - Add task_compaction_summaries table to store transcripts with metadata - Track trigger type (manual/auto), token count, and session info The transcript is saved but not injected back into prompts - Claude maintains its own compacted summary internally. Our saved transcripts serve as a safety net and audit trail. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
In addition to saving transcripts during compaction events, now also save the full conversation transcript when a task completes. This ensures we always have a record of what Claude did, even if compaction never occurred during the task. Trigger types are now: - "auto" - automatic compaction when context fills - "manual" - user ran /compact command - "completion" - task finished successfully Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
bborn
added a commit
that referenced
this pull request
Jan 31, 2026
The task_compaction_summaries table was bloating the database (1.4GB for 62 rows) by saving full JSONL transcripts when Claude auto-compacts. This feature was added in PR #105 but never provided real value. Removed: - task_compaction_summaries table and migrations - CompactionSummary struct and all DB methods (SaveCompactionSummary, GetCompactionSummaries, GetLatestCompactionSummary, ClearCompactionSummaries) - MCP server include_transcript parameter for workflow_show_task - PreCompact hook handler in main.go - saveTranscriptOnCompletion function in executor - All related tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 tasks
bborn
added a commit
that referenced
this pull request
Jan 31, 2026
The task_compaction_summaries table was bloating the database (1.4GB for 62 rows) by saving full JSONL transcripts when Claude auto-compacts. This feature was added in PR #105 but never provided real value. Removed: - task_compaction_summaries table and migrations - CompactionSummary struct and all DB methods (SaveCompactionSummary, GetCompactionSummaries, GetLatestCompactionSummary, ClearCompactionSummaries) - MCP server include_transcript parameter for workflow_show_task - PreCompact hook handler in main.go - saveTranscriptOnCompletion function in executor - All related tests Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PreCompacthook to save the complete conversation transcript to our database before compaction occurstask_compaction_summariestable to store transcripts with metadata (trigger type, token count, session info)cleanupPeriodDays)Why this is better than just letting Claude compaction proceed
How it works
PreCompacthook fires when Claude is about to compact (manual/compactor auto when context fills)task_compaction_summariestable with metadataThe saved transcript is not injected back into prompts - Claude maintains its own compacted summary. Our transcripts serve as a safety net.
Test plan
SaveCompactionSummary,GetCompactionSummaries,GetLatestCompactionSummary🤖 Generated with Claude Code