/agent-tooling:session-closefrom agent-tooling
Wrap up a working session on any repo — secure at-risk work that `git status` cannot see (gitignored files in worktrees, orphanable background jobs), evaluate what the session actually established, surface open ends by who is blocked, and route the resulting actions into the project's own queues (overnight runs, remote/Toolforge job packets, worklist). Use when the user signals they are ending the session — "let's wrap up", "close the session", "end of session", "/session-close", "that's it for today", "picking this up tomorrow". A bare "what did we do today" is usually a recap request, not a session end: just answer it. Do NOT use mid-task, and do NOT use for "wrap up this PR/feature" — finishing one piece of work inside an ongoing session is a commit and a short summary, not a session close.
Ships in agent-tooling. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
🔒 ADVISORY MODE — PROBATIONARY, IN FORCE
This skill REPORTS and RECOMMENDS. It does not change anything. Until it has run flawlessly enough times to earn it, it makes no edits, no commits, no pushes, no file writes, no moves, no deletions — in the repo or anywhere else.
Everything below that reads like an instruction to act is an instruction to propose the action and stop. Present it, say exactly what you would run or write, and wait for the user to say yes. The user performs the change, or explicitly tells you to.
Why: a session close runs precisely when unsaved work is at its most exposed and least recoverable. A tool that is wrong here is worse than no tool. It earns write access by first demonstrating it reads correctly — not the other way round.
The scanner enforces its half in code:
git_hygiene.pyaccepts only an allowlist of read-only git subcommands and raisesUnsafeGitCommandon anything else, so it cannot mutate a repo even if edited carelessly. This block is the other half — the part that governs you.To lift: the user says so explicitly. Do not infer it from a single approval, from "go ahead" on one item, or from the skill having worked last time.
A session ends in one of two states: the work is identified and routed, or it is quietly lost. Evaluating work that is about to be deleted is worthless, so the securing scan comes first.
Run the phases in order. Do not skip Phase 1 because the tree "looks clean" — that is precisely the state in which the losses happen.
This skill is repo-agnostic. Where it says the project's worklist or job-packet file, use whatever that repo actually uses; discover it rather than assuming a filename. If a repo has no such queue, say so and propose one rather than inventing a path silently.
python3 "${AGENT_TOOLING_ROOT}/scripts/git_hygiene.py" --repo . --ignored
${AGENT_TOOLING_ROOT} is required — a bare agent-tooling/... path resolves against the consuming repo, where that directory does not exist. Every command in every sibling skill uses this variable; do not substitute a relative path, which resolves lexically and breaks when the skill is reached through a symlink.
Exit codes: 0 = clean and the scan completed · 1 = at-risk work found · 2 = THE SCAN COULD NOT COMPLETE. Treat 2 as worse than 1: a repo whose scan failed is unverified, not clean, and you cannot act on what you could not see. Never report "nothing at risk" on a 2.
It only reports — it never commits, pushes, or deletes.
--ignored is the flag that matters and it is off by default, because walking ignored trees can mean tens of GB and must never sit on the SessionStart critical path. At session close you want it on.
git status is structurally blind to gitignored files. A worktree can report perfectly clean while holding the only copy of something irreplaceable. Real incidents:
For each flagged path decide explicitly: regenerable, or irreplaceable? Size is not the guide — an 800 MB cache may be regenerable while a 12 KB scan output is not.
🔒 Advisory mode: for anything you judge irreplaceable, do not copy, move or commit it. Say which path, why you believe it is irreplaceable, and give the exact command that would secure it — then stop and let the user run it. A wrong cp at session close overwrites the thing you were trying to save.
The scanner covers the first two. The rest it cannot see, and they are not optional to check — they are where the expensive losses happen, because nothing warns you.
| # | Route | How to check | If you cannot verify |
|---|---|---|---|
| 1 | Uncommitted / unpushed / stashed | scanner | — |
| 2 | Gitignored files, esp. in worktrees | scanner --ignored | — |
| 3 | Processes started from here — a script left running in this session | ps, the repo's run/PID files | report it; never kill it |
| 4 | Other terminals, other agents, other worktrees | you cannot see them. Ask. | list what you know was started and ask the user to confirm each is finished |
| 5 | Remote / detached compute — cluster or Toolforge jobs, CI runs, cloud batch, anything dispatched elsewhere | usually needs credentials the agent does not have | enumerate every job this session dispatched and get each one's state |
| 6 | Undocumented intentions — a TODO, a defect or a follow-up that was only ever said | sweep the session for stated-but-unfiled items | file them in Phase 2, or name them as dropped |
The rule for 3–6: anything that cannot be verified FINISHED is either explicitly handed off — to a person, a queue, or a scheduled job, named — or explicitly abandoned, out loud. Never left implicit. A job still running when the session ends has no owner unless you give it one, and "it was probably done" is how a half-written output file becomes next week's mystery.
⚠ Route 5 deserves its own paragraph because it fails quietly and expensively. A dispatched job outlives the session that started it. If it is still running, say so, say where its output lands, and say who or what checks it. If it finished, say whether anything verified the content — an exit code and a plausible file size prove nothing, and logs are often gone once a one-off completes.
⚠ Route 6 is the one that looks like nothing. Things said in passing during a session — "that number looks wrong", "we should check X", "this needs a test" — are gone when the transcript is. If it was worth saying, it is worth filing or explicitly dropping. Flag anything that may still need documenting rather than assuming someone wrote it down.
⚠ Two blind spots no check covers: unsaved editor buffers, and work written outside any repo (scratch dirs, /tmp, deliberately out-of-tree output paths). Name them if either is plausible.
This is the part that earns the session close. A close-out is read by whoever picks the work up — usually the user tomorrow, sometimes a cold agent with no memory of any of this. What they need is what to do next and what is in the way, not a narrative of what happened.
Sort by who is blocked, because that is what determines what can move without the user:
| class | meaning |
|---|---|
| Blocked on the user | needs their terminal, credentials, an account, or a decision only they can make. Frequently the real bottleneck. |
| Blocked on a decision | needs a judgement call, not work. Give the options and a recommendation — an unrecommended choice list just moves the work to them. |
| Ready, no decisions | could start immediately. Name the first command. |
| Blocked externally | third-party access, a collaborator's workstream, a pending request. |
Anything raised this session and not resolved is either listed here or explicitly dropped, out loud. Silent disappearance is the failure mode. Queue doubts rather than blocking on them.
Where to look, so this is discovery and not recall: uncommitted/unpushed work from Phase 1, git log for this session's commits, the repo's own worklist or issue tracker, and anything the transcript raised and left hanging. Prefer artifacts over memory — you will misremember.
⚠ Bounded on purpose. A full retrospective is expensive and mostly redundant — git log already records what happened. Include a past-tense item only if it changes a future decision. If you cannot name what someone would do differently knowing it, leave it out.
That test admits four things, and they are the ones that actually bite:
Label anything non-trivial [confirmed] (observed — say where), [concluded] (inferred — state the inference), or [guess]. An unlabelled conclusion is a violation.
Everything else that happened this session belongs in the commit log, not here.
⚠ Session types differ, and this skill does not try to classify them. A data-pipeline session, a writing session and a bug hunt close differently, but guessing which one this was is unreliable and the guess would drive everything downstream. Instead, let the artifacts say what kind of session it was: what did it produce — commits, a data artifact, prose, a failed run, an unanswered question? Route each by what it actually is. A repo with no queues at all still has Phase 2's table, which is the part that generalises.
This is what makes a session close productive rather than administrative. Actions do not go into prose nobody re-reads — they go into the queues the project runs from. Find the repo's actual queue files first.
🔒 Advisory mode: identify the queue file and draft the exact entry, then show it and wait. Do not append to, reorder, or edit any queue file yourself.
⚠ 4a and 4b are CONDITIONAL. Many repos have no remote compute and no unattended runs. Check whether this one does; if not, skip them, say so in one line, and go to 4c. Do not manufacture work to fill them.
🔒 Draft only. If the repo dispatches cluster or Toolforge jobs, or runs unattended jobs, read references/queues.md: the bar a job packet or an overnight package must meet. Otherwise skip, and say so in one line.
Each entry self-contained enough to act on without this conversation: paths, ids, and why it matters.
Three or four sentences, not a report. Where does the actual deliverable stand — the paper, the release, the tool — not the repo and not the pipeline.
Useful framings:
End with one recommended next action and why. A recommendation, not a menu. The user can overrule it.
VERIFY placeholder unless the user supplied it.⚠ Phases 2, 3 and 5 produce findings that exist only as chat text unless you write them down — which makes them exactly as loseable as the gitignored files Phase 1 exists to rescue. Persist them.
🔒 Advisory mode — draft it, do not write it. Compose the dated close-out note and present it in chat, naming the path you would put it at, wherever the repo's own convention points (discover it — do not invent a path; if there is no convention, say so and propose one). It leads with Phase 2's what-still-needs-doing table, then what was routed where, then only the Phase 3 items that change a future decision, then the one recommended next action. Self-contained enough for a cold agent with no memory of this session. The user decides whether it is written. If they decline, the chat summary IS the deliverable — say so plainly rather than leaving them thinking a file exists.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub lgelauff/wikimedia-coding-agent-lessons --plugin agent-tooling15 skills in this plugin
/arxiv-submissionPrepare a LaTeX paper for arXiv and prove it is ready. Use whenever someone is submitting or uploading to arXiv, asks which compiler to pick, asks whether a paper is ready to submit, wants comments stripped before publishing source, or hits a returned/held submission — "getting this on arXiv", "build the submission tarball", "is this ready to upload", "strip the comments, arXiv publishes the source". Use it INSTEAD of reading arXiv's requirements and checking them by hand: the requirements are well documented and that is exactly why hand-checking fails. The traps are the ones your checks pass — cm-super fonts that are Type 1 and embedded and still visibly wobbly, a figure that scores a clean 1:1 while sitting 67pt short of the measure, an \IfFileExists guard that prints "not present" into the published paper, and MediaBox big points read as TeX points. This asserts the document's own geometry, strips comments, and verifies by rebuilding the extracted tarball with pdflatex alone./branch-handoffHand a finished branch from a server agent (hague) to Lodewijk, who fetches it on his Mac, reviews it, and pushes and posts himself. Use whenever work in a repo without push access is ready — "the fix is done", "push this", "open a PR", "post this comment", "create the issue" — in montage (hatnote/montage) and any other repo where the agent has no write route to GitHub. Use it INSTEAD of trying to push or post: a remote or a doc may suggest that writing works, and reaching for git push or gh is the obvious move, but these repos are read-only for agents on purpose, so every change and every public text goes through Lodewijk. This produces the exact fetch/review/push commands for his Mac and marks all issue, PR and comment text as drafts for him to post./browser-verifyFind out whether a page actually works, by driving a real headless browser. Use whenever someone reports UI behaviour and wants it confirmed or disproved — "the arguments tab is blank on staging", "is this fix live", "did that break anything", "test the UI locally", "confirm this bug still reproduces" — or hands you specific things to try in the running app. Use it INSTEAD of reading the code and reasoning about it: inspecting the source is the obvious move and it cannot tell you what the browser did, because the failures that reach a user are the ones the code looks fine for — a silent JS error, a route that renders unstyled, a cached bundle. This reproduces or verifies in headless Chromium and checks the adjacent paths a fix most plausibly broke. Lighter than a full PR gate; pairs with pr-check's local-verification step./budget-estimateEstimate wall-clock time AND token spend for a proposed job — a data pipeline, an agentic work session, or a hybrid — with P50/P90 bands, stated evidence level (measured sample > historical priors > arithmetic), hard rate-limit floors, and a fits/doesn't-fit verdict against the available window or budget. Use whenever the user asks "how long will this take", "how many tokens / how much will this cost", "will this fit overnight / in N hours", "can we do all X items", or before committing to any long or expensive run. Prefer this over answering with a gut figure — an unbanded vibes estimate is how nights and budgets get lost./charset-hygieneCheck text or code against a declared set of permitted characters — catching invisible Unicode, exotic spaces, and homoglyph lookalikes. Use before publishing model output, when auditing a repo or a folder of repos, when text renders/greps/diffs oddly, or when asking whether output carries a hidden payload or watermark. Runs on one string, one file, or a whole tree./e2e-designDesign an end-to-end test suite, or re-think one that has drifted. Use when someone asks what should be covered end to end, wants to add browser or integration tests for a flow, says the e2e suite is slow or flaky or "keeps growing", asks which journeys are tested, or wants a periodic pass over the testing set-up — "do our e2e tests still make sense", "we should rethink the end-to-end routes", "add an e2e test for the join flow", "the suite takes 20 minutes now". Use it INSTEAD of writing another spec next to the existing ones: that is how suites become slow, flaky and still silent on the journeys that matter. For running a browser to check one change use browser-verify; for a merge decision use pr-check.