/session-flow:tidy-work [report|normalize|clean] [--days N] [--offline] [--memory-dir DIR] [--scope all|repo|home]from session-flow
Reports, normalizes, and cleans stale .work memory items (repo and ~/.work) with age, size, and kind inventory. Scrubs scratch files tied to closed issues/PRs on user confirmation.
Ships in session-flow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The memory root (default .work/) and ~/.work collect handoffs, running-retro ledgers, workflow checklists, and slice folders
that nothing else deletes, and agents drop scratch files beside them whose names carry the issue or
PR they were for. This skill inventories them with age, size, and kind, attributes each scratch
entry to that issue or PR and reports its state, marks what is still in flight, and, only on
request, moves misplaced items into the standard layout or removes stale ones.
${CLAUDE_PLUGIN_ROOT}/scripts/tidy_work.py does the work; this skill sequences it and owns the
confirmation.
Nothing runs unless the user invokes this skill.
| Action | Effect |
|---|---|
report (default) | Read-only inventory: path, age, size, kind, in-flight or stale, per item; a scratch entry also shows the issue or PR its name carries and that item's state |
normalize | Moves misplaced known-kind items into the standard layout. Never deletes, never overwrites an existing target |
clean | Removes an item only when it is a known kind, is not in flight, and names at least one issue or PR, every one closed or merged: a handoff or running retro by the references in its text, a scratch entry by the number in its name. An item that names no issue or PR is kept and reported however old it is; a slice or checklist has no attribution source, so clean never removes one; a shape-3 chain's handoffs/archive/ directory is kept while a handoff of its chain is kept and leaves with the last one |
Pass --days N (default 14) to change the recency window. Pass --scope {all,repo,home} (default
all) to limit inventory, normalize, or clean to the repo memory root (repo), $HOME/.work
(home), or both (all). Pass repeatable --extra-concern-dir NAME (or set extra_concern_dirs
in <convention_home>/session-flow.yaml) to treat additional bare directory names under the memory
root as kept concern state. Pass --offline to treat every linked issue or PR as unknown, which
counts as in flight; without it the script asks gh for the open issues and PRs of each repository
a handoff names, then for the state of each link that is not open.
A scratch entry is any other top-level entry whose name holds exactly one all-digit token of 3 to
7 digits, optionally prefixed pr, issue, or gh: lint-5371.log, measure-4608,
scratch-4586-d2cc1ea4d. That number is read as an issue or PR of the repository holding the
memory root. A year-like token (1900 to 2099) counts only with the prefix: pr2026.md is
attributed, backup-2026.tar is not. A name with no such token, or with several (a version, a
date), is not attributed and stays unknown.
memory_dir the repo documents in prose (CLAUDE.md or
.claude/rules/), else the default .work. Pass the result as
--memory-dir <root> on every invocation below; a --memory-dir the user gave wins. The
resolution order is the one handoff uses
(${CLAUDE_PLUGIN_ROOT}/reference/save-point.md,
"Where save-points live").python3 ${CLAUDE_PLUGIN_ROOT}/scripts/tidy_work.py report --memory-dir <root> [--scope all|repo|home] [--days N] [--offline] [--extra-concern-dir NAME]
and show the table. report is the only tidy_work.py invocation allowed-tools
pre-approves. For report alone, stop here.normalize or clean. Run the same script with the action name and no
--apply. It prints the exact absolute path of every move or removal and changes nothing; a
path whose issue or PR was looked up carries [#N state], and for a scratch path that is the
number its name was attributed to. Show those lines to the user verbatim.--apply. That call is not
pre-approved, so it goes through the normal permission flow. Report what moved or was
removed, and any path the script refused.An item whose kind is not recognized (for example a drain/ status tree or any tool's own
folder) is always kept and always reported, by report, normalize, and clean alike. So is
every entry of another skill's concern dir (reviews/, exports/, overengineering/,
enforceability/, docs-hygiene/, lanes/, coupling/, recommend-skills/, testing/,
testing-cleanup/, testing-cleanup-plan/, plus any extra_concern_dirs declared in
<convention_home>/session-flow.yaml or via --extra-concern-dir): that skill reads it back.
Explicit non-removable kinds git-clone (a directory holding a .git file or directory;
.git/objects is not walked for stats) and recovery-archive (*.bundle, *.tar, *.tar.gz,
*.tgz, *.zip, or directories containing them) are always kept and reported with their size and
a manual handoff hint. So is every item that
names no issue or PR, whatever its kind and age, because nothing says whose it is or whether it
is the only copy: a handoff or running retro whose text names none, and every slice and
checklist. In-flight items are kept too:
INDEX.md status: is not done, or that holds a child slice whose status is
not done (active, parked, missing, and unrecognized all keep it).git file or directory under it (a clone or worktree can hold commits that
exist nowhere else)No flag overrides any of these.
--apply and a confirmation naming the paths..gitignore
lacks a line * (or **), refuses an item with a tracked file under it, and rejects a memory root that
is the repository root.memory_dir comes from a file the repository
controls, and report is pre-approved, so every action rejects an existing memory root outside
the repository unless its .gitignore holds a line * (or **), the guard the handoff writer requires./session-flow:handoff and
/session-flow:clean-stop./session-flow:clean-stop makes the remaining repo and worktree state durable before the machine goes away.
--offline reads as "in flight", not "stale". With link state unknown, every handoff
or scratch entry that names an issue or PR is kept, and one that names none is kept anyway, so
an offline clean removes nothing. That is the safe direction.results-4608.json is attributed to #4608 whether or not it has anything to do with it; the
number must exist in the repository to count, but the match is not proof. Read the [#N state]
on each path in the dry run before confirming, and decline the run if one is not yours to
remove. In ~/.work, where no repository is known, every scratch entry stays.#N is a reference into the repo that holds the memory root. A handoff written in
another repo can name an unrelated open item of this one and stay; in ~/.work, where no
repository is known, a bare #N counts as unknown and keeps the handoff unless a running-retro
file in ~/.work/running-retros/ carries a repo-qualified frontmatter repo: owner/repo, header,
or owner--repo slug. owner/repo#N and
github.com/.../issues/N URLs are looked up in the repository they name.--apply,
re-run the dry-run and ask again rather than applying a stale list.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub melodic-software/claude-code-plugins --plugin session-flow20 skills in this plugin
/audit-frictionAudit frictionAudit Claude Code sessions for permission and autonomy friction (denials, approval prompts, hook blocks, hand-offs), traced to cause in one decision brief. Use when the agent keeps asking or handing off, auto mode denies, or re-measuring after permission fixes./audit-sessionsAudit sessionsAudit every Claude Code session on this machine or behind a pull request for wasted time and tokens against a baseline, routing findings to fixes, plus score trends over time. Use when: 'audit my sessions', 'which sessions burned the most tokens', 'retro this PR', trends, or repeating corrections. Not for one session: /session-flow:retro./clean-stopClean stopClean stop before the machine goes away: sweep every repo and worktree touched for uncommitted, unpushed or PR-less work, push it, and give a free-and-clear verdict. Use when: 'clean stop', 'safe to shut down', or stopping for the day. Gates destructive cleanup./continue-in-backgroundContinue in backgroundHand the task to a fresh detached background agent (claude --bg or --cloud) that continues it now from a save-point. Use when the user is going AFK and explicitly asks to 'continue in the background'. Launches only on that request, never self-elected./find-handoffFind handoffRecover a lost handoff save-point or resume prompt after /clear, from the handoffs folder then recent transcripts, confirming before resuming. Use when: 'find my handoff', 'I lost the resume prompt'. A session that ended mid-work: /session-flow:keep-going./go-with-recommendationsGo with recommendationsAccept the agent's latest recommendations after re-grounding each in code/sources, surfacing changed or unconfirmable items; supports exceptions.Other plugins' skills for the same job