Skip to content
Back to skills

Session Closeout

ASecurity

Preserve durable lessons and produce an archive-safety receipt before ending, clearing, or archiving an agent task. Use without being asked when a task reaches its finish line (its PR merged and its worktree removed, or the deliverable handed over), and when the operator says close out, wrap up, end the session, prepare the task for archive, make it archive-ready, or invokes $session-closeout after substantive work.

  • 2 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 22, 2026
ai-agentspythongobashgitdatabasedocumentation

Works with

  • claude code
  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 6, 2026

npx -y skills add nino-chavez/agentic-ways-of-working --skill session-closeout --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Session Closeout?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Session Closeout
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nino-chavez-session-closeout/badge)](https://www.skillsdirectory.com/skills/nino-chavez-session-closeout)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: session-closeout
description: Preserve durable lessons and produce an archive-safety receipt before ending, clearing, or archiving an agent task. Use without being asked when a task reaches its finish line (its PR merged and its worktree removed, or the deliverable handed over), and when the operator says close out, wrap up, end the session, prepare the task for archive, make it archive-ready, or invokes $session-closeout after substantive work.
---

# Session Closeout

Keep what should survive the task without treating the full transcript as permanent memory.

## Workflow

1. Reconstruct the outcome from the workspace and external receipts. Inspect the relevant status, diff, tests, artifacts, and deployment evidence. Treat prior summaries as leads, not proof.
2. Sort the residue:
   - stable project truth that belongs in an existing canonical document;
   - a reusable method that belongs in the configured memory or recipe store;
   - chronology that can disappear with the transcript;
   - unresolved work, secrets, private material, or unverified claims that block safe archival.
3. Decide the fate of the workspace this task created. List each linked worktree, branch, file written outside git, and running dev server, database stack, or browser tab the task started (`git worktree list`, `git branch`, `git status --porcelain` in each checkout it wrote to, the session scratchpad, the commands it ran). Give each exactly one disposition and record it:
   - merged into the base branch, or landed by squash or cherry-pick (confirm with `git cherry <base> <branch>` or a content check): remove the worktree with `git worktree remove` (no `--force`) and delete the local branch. If git refuses because the worktree contains submodules, `git worktree remove --force` is correct once both of these, run in the worktree, print nothing: `git status --porcelain --ignore-submodules=none` and `git submodule foreach --quiet --recursive 'git rev-list -n 1 --all --reflog --not --remotes'`. The second one lists any commit made in a submodule that no remote has. `--force` deletes each submodule's repository along with its files, and a clean status does not show such a commit. Never run `git submodule deinit` in a linked worktree: it unregisters the main checkout's submodules too;
   - commits not in the base branch: push the branch so the work is not only on this machine, and name the open PR or the reason it stays open;
   - uncommitted changes: commit them to the task's branch, or state why they are discarded. Never leave them undecided;
   - evidence in an ignored folder that is still needed (`.artifacts/`, receipts, a backup app): move it to the repository-level `.artifacts/` or a canonical document before removing the worktree, and name what was kept;
   - a process the task started: stop it.
   - a file the task wrote outside git (the session scratchpad, `/tmp`, a notes or handoff folder, an untracked file in a shared checkout, an external drive): delete it, or first move it to a durable home (the repository, a tools folder, or beside the thing it records) and name where. A receipt that memory or a document points to must live somewhere that outlives the session; a scratchpad or an app-managed notes folder does not.
   - a worktree or ignored folder that a build or release depends on: lock it with `git worktree lock --reason "<what depends on it>"`, or move the dependency to the repository-level `.artifacts/`. A note in memory protects nothing; the reaper and fleet sweeps skip locked worktrees.
   Touch only what this task created. Leave a worktree held by a live session, a locked one, and the worktree this session is running in (its host removes that one). Report anything you could not decide. Reclaiming build output in idle worktrees is the reaper's job, not this step's.
4. Scan this session's transcript for credentials. Run it after step 3, so it also covers the commands the closeout ran. In Claude Code:

   ```bash
   python3 "${CLAUDE_SKILL_DIR}/scripts/secret-scan.py" --session-id "${CLAUDE_SESSION_ID}"
   ```

   Codex fills in neither variable, so that command fails there. In Codex, run `scripts/secret-scan.py` from this skill's directory with `--session-id "$CODEX_THREAD_ID"`; Codex names each rollout file after that thread id, and packs it into `.jsonl.zst` a week after its last write; the script reads both. In any other harness, pass `--transcript <this session's file>`. With no arguments the script takes the newest session for the current folder. In every case, check that the `Scanned:` line names this session. The scan prints names and line numbers, never values. Do not print or quote a value to judge a finding.
   - Exit 0 is clean. Exit 2 means the scan did not run, which is not clean.
   - `live` means a credential that is current in this environment was printed into the transcript. You cannot rotate it. Make rotating it the receipt's next step.
   - Any other finding: it was rotated, or it is not a credential (a test fixture, a public client key, documentation). Say which. Otherwise treat it like `live`.
5. Prefer an existing source of truth over a new recap file. Update it only when the task already authorized the underlying change. Never manufacture human approval, readiness, or evidence.
6. Save a reusable recipe only when another task is likely to benefit. Use the project's documented memory command or knowledge store. If `~/.config/session-closeout/recipe-store.md` exists, it names this machine's store for each harness; follow it. Keep the entry short, sourced, and free of raw private text. If no durable recipe exists, save none.
   Then report what retrieved memory did. If this session retrieved records from a memory store that accepts outcome reports, report each record that shaped the work: `helped` when following it moved the work forward as written, `misled` when following it cost time or gave a wrong result. A record that was followed and cost time is `misled` even if the task still finished. Do not report a record that was retrieved but not followed, and do not report `helped` out of courtesy: the note names what the record changed. The store keeps one report per record and session, so running closeout twice is safe. When `recipe-store.md` exists, it names the call for each harness, including where its session and actor values come from; use the same values every time so the store can drop repeats. If a record shaped the work and no call is named, write that under Still open: never write "none retrieved" for a record you used.
7. Check that a lifecycle hook will queue this transcript, but do not wait for it. The hook runs when the session ends, after the receipt, so it cannot be confirmed here. Read the harness's hook configuration (in Claude Code and Codex, a `SessionEnd` hook), and in the receipt say the transcript is queued at session end. If no hook is configured, list that under Still open. Do not perform mining inside the hook; the hook should enqueue identity and return quickly.
8. Do not archive or delete the task. Give the operator the receipt and let them take the irreversible action.

## Required receipt

The receipt is your closing message, written as Markdown that the reader takes in at a glance. Never wrap it in a code block: a fence renders as one monospace run with no links and no bold. Do not put a recap above it that repeats it. Keep every label, and write "none" or "nothing" instead of dropping one, so the reader can tell an empty answer from a forgotten one.

```markdown
### Archive-safe: <yes|no>. <For yes, a short reason, such as "Ready to archive." For no, the blocker.>

**Your next step:** <one concrete action, or none>.

**What landed**
- [<repo>#<number>](<full PR URL>): <what it changed, in plain words>

**Still open:** <each claim not yet proven, or item waiting on someone; or nothing>

**Saved for later:** <each canonical document, memory, or recall recipe updated, and what it holds; or nothing new>

**Memory outcomes:** <each retrieved record reported, with its outcome; or none retrieved; or retrieved, none followed>

**Checks**
- Secret scan: <clean; or each finding (kind and name) with its disposition; or error>
- Evidence: <how you verified what landed>
- Cleanup: <each worktree, branch, process, and file outside git this task created, with its disposition; or none>
```

When the answer is `no`, the first line names the blocker, and the next step clears it. Example: `### Archive-safe: no. A live token was printed into this transcript.` then `**Your next step:** rotate the Cloudflare token.`

Write it to be read, not parsed:

- One item per bullet, about 15 words or fewer after the link. A label with one short answer keeps it on the label's line; two or more become bullets.
- Link every PR with short text, `[repo#number](full URL)`, then say what it changed. In the desktop app, link text of the form `owner/repo#number` turns into a wide chip with a truncated commit title and a cached state that can be stale (a merged PR showed as open). Short link text stays a plain link, and the plain clause carries the meaning.
- When more than about six items landed, list the ones that change behavior and fold the rest into one bullet, such as "Follow-ups, all merged:" and their links.
- Group cleanup by disposition when several items share one ("4 task branches merged; their worktrees and branches removed").
- Use backticks only for a path, SHA, or command the reader would copy.
- The verdict is the only heading: bold barely shows in the app's dark theme, and the heading also marks where the receipt starts. No other headings, no tables (long cells wrap badly in a chat column), no nested lists. Fit the receipt on one screen.

Set `Archive-safe: yes` only when the durable lesson is stored, the secret scan exited 0 or every finding is rotated or shown not to be a credential, evidence is named, every worktree, branch, process, and file outside git the task created has a recorded disposition, no commit exists only on this machine, nothing still needed lives only in a scratch location, and nothing requires the raw transcript to resume safely.

Files in this skill

  • SKILL.md2.1 KB
  • agents/openai.yaml237 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.