--- 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 ..HEAD # Changed file summary git --no-pager diff --stat ..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 ### Files changed ### Deploys ### 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`.