Records session facts (git log, diff --stat, deploys from transcript) by appending to docs/sessions/YYYY-MM-DD.md with a mandatory narrative placeholder. Never touches backlog.md or CLAUDE.md without explicit instruction. Commits only the session file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
66 lines
1.8 KiB
Markdown
66 lines
1.8 KiB
Markdown
---
|
|
name: save-session
|
|
description: Save and record the current work session to docs/sessions/. Trigger ONLY on explicit "save session", "zapisz sesję", or "wrap up" — never invoke proactively between tasks.
|
|
---
|
|
|
|
**Trigger condition**: user explicitly says "save session", "zapisz sesję", "wrap up", or equivalent.
|
|
Never invoke proactively. Never invoke mid-task.
|
|
|
|
## 1. Determine Session Boundary
|
|
|
|
1. Read the latest entry file in `docs/sessions/` — use its last `## Session HH:MM` heading timestamp as the start boundary.
|
|
2. Fallback if no previous entry exists: 24 hours ago.
|
|
|
|
## 2. Collect Facts (deterministic only — no invention)
|
|
|
|
Run exactly:
|
|
```bash
|
|
# All commits since boundary
|
|
git --no-pager log --oneline <boundary>..HEAD
|
|
|
|
# Changed file summary
|
|
git --no-pager diff --stat <boundary>..HEAD
|
|
```
|
|
|
|
From the visible conversation transcript: deploys run and their outcomes, test results seen.
|
|
|
|
## 3. Write the Session Entry
|
|
|
|
**APPEND** to `docs/sessions/YYYY-MM-DD.md` (create the file if it doesn't exist for today).
|
|
Never overwrite existing content.
|
|
|
|
```markdown
|
|
## Session HH:MM
|
|
|
|
### Commits
|
|
<output of git log --oneline>
|
|
|
|
### Files changed
|
|
<output of git diff --stat>
|
|
|
|
### Deploys
|
|
<list from transcript, or "None recorded">
|
|
|
|
### Narrative
|
|
> _user-provided summary_
|
|
```
|
|
|
|
The `> _user-provided summary_` placeholder is **mandatory**. Never fill it in. The user supplies the narrative separately if desired.
|
|
|
|
## 4. What NOT to Touch
|
|
|
|
- `backlog.md` — only on explicit "update backlog" instruction
|
|
- `CLAUDE.md` — only on explicit "update CLAUDE.md" instruction
|
|
- Any other file not listed above
|
|
|
|
## 5. Commit
|
|
|
|
Stage and commit **only** the session file:
|
|
|
|
```bash
|
|
git add docs/sessions/YYYY-MM-DD.md
|
|
git commit -m "docs: session YYYY-MM-DD HH:MM"
|
|
```
|
|
|
|
No other files. No `git add -A`.
|