Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to claude-reflect will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- **`SessionEnd` hook** — New `session_end_log.py` hook that fires at session end to
capture a structured activity summary (topics covered, tools used, corrections detected).
- Writes to `~/.claude/session-logs/YYYY-MM-DD-HHMMSS.md` by default
- Optional webhook: set `CLAUDE_REFLECT_SESSION_LOG_WEBHOOK=<url>` to POST JSON payload
- Optional command: set `CLAUDE_REFLECT_SESSION_LOG_COMMAND=<cmd>` to pipe JSON to a custom script
- Disable entirely: set `CLAUDE_REFLECT_SESSION_LOG=false`
- Skips very short sessions (< 4 messages) to avoid noise
- **23 new tests** in `tests/test_session_end_log.py` covering parse_session, derive_topics,
format_markdown, format_json, write_local, and _extract_texts.

## [3.1.0] - 2026-03-16

### Added
Expand Down
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ tests/ → Test suite (pytest)
- `scripts/lib/semantic_detector.py`: AI-powered semantic analysis via `claude -p`
- `scripts/capture_learning.py`: Pattern detection (correction, positive, explicit markers) with confidence scoring
- `scripts/check_learnings.py`: PreCompact hook that backs up queue before context compaction
- `scripts/session_end_log.py`: SessionEnd hook that captures activity summary (topics, tools, corrections); writes local file or calls webhook/command
- `scripts/extract_session_learnings.py`: Extracts user messages from session JSONL files
- `scripts/extract_tool_rejections.py`: Extracts user corrections from tool rejections
- `scripts/compare_detection.py`: Compare regex vs semantic detection on session data
Expand Down Expand Up @@ -87,6 +88,7 @@ The plugin registers via `.claude-plugin/plugin.json`:
| UserPromptSubmit | `capture_learning.py` | Detect corrections and queue them |
| PreCompact | `check_learnings.py` | Backup queue before compaction |
| PostToolUse (Bash) | `post_commit_reminder.py` | Remind to /reflect after commits |
| SessionEnd | `session_end_log.py` | Capture session activity summary |

## Detection Methods

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Example: You've asked "review my productivity" 12 times → suggests creating `/
| **Skill Discovery** | Finds repeating patterns in your history → generates commands |
| **Multi-language** | AI understands corrections in any language |
| **Skill Improvement** | Corrections during `/deploy` improve the deploy skill itself |
| **Session Logging** | Auto-captures session activity at end → local file + optional webhook |

## Installation

Expand Down Expand Up @@ -107,6 +108,7 @@ Hooks run automatically to detect and queue corrections:
| `capture_learning.py` | Every prompt | Detects correction patterns and queues them |
| `check_learnings.py` | Before compaction | Backs up queue and informs user |
| `post_commit_reminder.py` | After git commit | Reminds to run /reflect after completing work |
| `session_end_log.py` | Session end | Captures activity summary → local file or webhook |

**Stage 2: Process (Manual)**

Expand Down
11 changes: 11 additions & 0 deletions hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
}
]
}
],
"SessionEnd": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/session_end_log.py\""
}
]
}
]
}
}
Loading
Loading