| name | session-summary |
|---|---|
| model | fast |
| description | Generate an end-of-session summary capturing commits, TODOs, decisions, and next steps |
| usage | /session-summary [--since <timestamp|duration>] [--save] |
Generate a structured summary of work completed during the current session.
/session-summary [--since <timestamp|duration>] [--save]
Arguments:
--since(optional) — Start of the session window. Accepts ISO timestamp (2025-06-15T09:00), relative duration (3h,90m), ortoday. Defaults to3h.--save(optional) — Save the summary todocs/sessions/YYYY-MM-DD.mdin addition to terminal output.
/session-summary # Summarize the last 3 hours (default)
/session-summary --since 2h # Summarize the last 2 hours
/session-summary --since 2025-06-15T09:00 # Summarize since a specific timestamp
/session-summary --since today # Summarize everything committed today
/session-summary --since 4h --save # Summarize last 4 hours and save to file
- Resolves the session window from the
--sinceargument or defaults to the last 3 hours - Parses git log for all commits made within the session window using
git log --since - Collects diff stats for every file changed during the session via
git diff --stat - Scans
TODO.mdandtask_plan.mdto identify TODOs completed and still pending - Reads commit messages and inline comments for decision signals (keywords: "decided", "chose", "switched to", "trade-off", "instead of")
- Extracts blockers and open questions from TODOs, commit messages, and code comments tagged
FIXME,HACK,XXX, orQUESTION - Compiles a list of next steps inferred from pending TODOs, open questions, and incomplete work
- Formats the summary using the session summary template (see Output section)
- Outputs the summary to the terminal for review
- Saves the summary to
docs/sessions/YYYY-MM-DD.mdwhen--saveis passed, creating the directory if needed
Use TodoWrite to track progress through each phase.
Determine the start boundary of the session from the --since argument.
| Input Format | Resolution |
|---|---|
Nh (e.g., 3h) |
Current time minus N hours |
Nm (e.g., 90m) |
Current time minus N minutes |
today |
Midnight of the current day |
ISO timestamp (e.g., 2025-06-15T09:00) |
Use as-is |
| No argument | Default to 3h |
Store the resolved timestamp as SESSION_START for use in all subsequent phases.
Run the following git commands to gather commit and file-change data:
# All commits in the session window
git log --since="$SESSION_START" --format="%h|%s|%an|%ai" --reverse
# Per-file insertion/deletion counts
git diff --numstat $(git log --since="$SESSION_START" --format="%H" | tail -1)^..HEADIf no commits are found in the session window:
"No commits found since
SESSION_START. Expand the window with--sinceor checkgit log."
From the git diff --numstat output, build a table of files changed grouped by type: added, modified, deleted, renamed.
Read the following files to determine TODO state. Skip any that do not exist.
| File | Purpose |
|---|---|
TODO.md |
Project-wide task tracking |
task_plan.md |
Current task acceptance criteria |
docs/planning/roadmap.md |
Sprint and backlog items |
Classify each TODO into one of three categories:
| Status | Detection |
|---|---|
| Completed | Marked [x] and the file was modified within the session window |
| Pending | Marked [ ] and referenced in session commits or task plan |
| Unrelated | Marked [ ] but not referenced in session work — exclude from summary |
Search commit messages and changed files for decision signals:
# Decision keywords in commit messages
git log --since="$SESSION_START" --format="%s" | grep -iE "decided|chose|switched|trade-off|instead of|went with|opted for"
# Inline decision comments in diffs
git diff $(git log --since="$SESSION_START" --format="%H" | tail -1)^..HEAD -U0 | grep -iE "DECISION:|TRADE-OFF:|chose .* over|went with"Also check for ADR files created or modified during the session. Format each decision as a single-line entry with context.
Search for unresolved items in changed files (FIXME, HACK, XXX, QUESTION markers) and commit messages containing ?, blocker, blocked, unclear, or TBD. Also read TODO.md for items tagged with [blocked] or [question].
Compile next steps from three sources:
- Pending TODOs — items from Phase 4 that are still
[ ]and relevant to the session - Blockers — items from Phase 6 that need resolution before work can continue
- Incomplete work — commits with messages containing "WIP", "partial", "part 1", or "started"
- Test gaps — files changed without corresponding test changes
Present next steps as an ordered list, prioritized: blockers first, then pending TODOs, then follow-up work.
Assemble the full summary using the template in the Output section. If --save is passed:
- Create
docs/sessions/directory if it does not exist - Write the summary to
docs/sessions/YYYY-MM-DD.md - If the file already exists (multiple sessions in one day), append with an
## Afternoon Sessionor## Session 2header
The terminal output and saved file follow this structure:
# Session Summary — YYYY-MM-DD
**Window:** HH:MM – HH:MM (Xh Ym)
**Commits:** N
**Files changed:** M (+A, -D lines)
## Commits
| Time | Hash | Message |
|-------|---------|--------------------------------|
| 09:15 | a1b2c3d | Add rate limiting middleware |
| 09:42 | d4e5f6a | Fix token refresh race condition|
| 10:30 | b7c8d9e | Add tests for auth flow |
## Files Changed
| File | Changes | Type |
|-------------------------------|-----------|----------|
| src/middleware/rate-limit.ts | +95 -0 | added |
| src/auth/token.ts | +18 -7 | modified |
| tests/auth/token.test.ts | +42 -0 | added |
## TODOs
### Completed
- [x] Add rate limiting to /api/auth endpoints
- [x] Fix token refresh race condition
### Still Pending
- [ ] Add integration tests for rate limiting
- [ ] Update API documentation for new limits
## Decisions Made
- Chose token bucket algorithm over sliding window for rate limiting (simpler, sufficient for current scale)
- Decided to refresh tokens 5 minutes before expiry instead of on-demand
## Blockers & Open Questions
- QUESTION: Should rate limits be configurable per-tenant? (src/middleware/rate-limit.ts:23)
- FIXME: Token refresh retry logic needs exponential backoff (src/auth/token.ts:87)
## Next Steps
1. Resolve: per-tenant rate limit configuration decision
2. Add exponential backoff to token refresh retries
3. Write integration tests for rate limiting endpoints
4. Update API docs with rate limit headers and status codes
5. Deploy to staging and run load tests- Never fabricate commits. Only include commits that appear in
git logfor the session window. - Never mark a TODO as completed without evidence. The item must be
[x]in the source file or addressed by a commit in the session. - Never invent decisions. Only report decisions explicitly stated in commit messages, code comments, or ADRs.
- Never skip the diff stats. File change counts are essential for understanding session scope.
- Never include commits from outside the session window. Respect the
--sinceboundary strictly. - Never save to
docs/sessions/without the--saveflag. Terminal-only output is the default. - Never overwrite an existing session file without appending. Multiple sessions in one day should be preserved as separate sections.
- If no commits exist in the session window, report "No commits found" and suggest expanding the window with
--since. - If
TODO.mddoes not exist, skip the TODO section and note: "No TODO.md found — TODO tracking skipped." - If
task_plan.mddoes not exist, skip task plan scanning and proceed with git-only analysis. - If the session window is unreasonably large (>24h), warn: "Session window exceeds 24 hours. Consider narrowing with
--sincefor a focused summary." - If
git logfails (not a git repository), abort with: "Not a git repository. Run this command from within a git project." - If
docs/sessions/cannot be created when--saveis used, fall back to saving in the project root and warn the user. - If
ghCLI is unavailable and PR-linked commits are detected, skip PR metadata and note the limitation.
- Optional automation: Run
python3 scripts/session_changelog.pyto generate a per-session changelog from git activity. - Optional automation: Run
python3 scripts/context_diff.pyto show what changed in context files during this session.
- Command:
/start-task(establishes the task context that this command summarizes) - Command:
/review-code(run a review before closing out the session) - Command:
/debug-error(for unresolved errors surfaced in the summary) - Agent:
ai/agents/development/