feat(wrap-up): plan-aware branching — emit resume blocks when plan is incomplete#329
Merged
Conversation
…ncomplete Add Step 0 that decides whether this session's plan is actually done before running the standard cleanup pipeline. Plan identification uses the plan-mode `<system-reminder>` already injected into the conversation as the SSOT — never mtime, which races under heavy parallelism. TaskList is session-scoped by the harness, so it is safe to read directly. A plan is complete iff every TaskList task is `completed` AND every plan-file checklist item is checked (or has clear conversation evidence of completion), or no plan file exists for this session. - Path A (plan complete or absent): identical to the prior behavior — invoke `/refresh-repo`, `/retrospecting quick`, `/clean_gone`, emit forward-looking follow-up prompt. - Path B (plan incomplete): skip Path A (refresh-repo would prune the in-flight worktree) and emit one or more Resume Blocks. Each block is a `cd <worktree>` plus a self-contained prompt that re-points at the plan file, lists remaining checklist line numbers and TaskList task IDs, and notes what is already done so a fresh session does not redo work. Items are grouped by judgement, not blindly by repo: same repo + same goal stays together, same repo + unrelated threads split, cross-repo always splits. `/wrap-up purge-pr <PR>` is unchanged and still bypasses Step 0. Plan: ~/.claude/plans/update-wrap-up-so-that-cozy-quasar.md Assisted-by: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the wrap-up skill definition to support a dual-path workflow depending on whether the current session's plan is complete (Path A for clean wrap-up, Path B for emitting resume blocks). The review feedback correctly points out that the plan file paths and regex patterns are hardcoded to a specific user's home directory (/Users/jevans) and provides suggestions to make them generic and environment-agnostic.
… PR/issue refs The prior commit's frontmatter description contained `cd <repo>` literally. Anthropic's plugin validator (cclint) rejects angle brackets in `description`, which surfaced as a CI validate-plugin failure. Reworded to "cd-into-worktree blocks" — same meaning, no brackets. While here, codify a URL rule the user requested for any wrap-up output that references PRs or issues: emit the full `https://github.com/<owner>/<repo>/(issues|pull)/<n>` URL on first mention, never bare `#123`. The triage step now captures the `url` field from `gh issue list`, and the Resume Block template explicitly requires URLs for referenced PRs/issues. ci(precommit): add cclint as a local hook so the description-validator failure that escaped to CI on the prior commit fails at commit time instead. Uses pre-commit's `language: golang` to install `github.com/dotcommander/cclint@latest` into an isolated env — no Go toolchain on the host required. Logic lives in scripts/cclint-plugins.sh per the no-inline-scripts rule, mirroring the loop in .github/workflows/validate-plugin.yml. Verified locally: pre-commit run cclint-plugins --all-files passes on the fixed tree, and re-injecting `<repo>` into the description reproduces the exact CI error message. Assisted-by: Claude <noreply@anthropic.com>
gemini-code-assist flagged three SKILL.md sites that hardcoded `/Users/jevans/.claude/plans/...` paths and regex patterns. The plugin is published to the public marketplace, and the workspace secrets-policy bans committed user-specific paths. The matching regex in 0a would also never fire for any other plugin user. - Frontmatter Step 0a prose: describe the path shape generically (`<HOME>/.claude/plans/<slug>.md`) instead of naming one home. - 0a regex: `[^[:space:]]+/\.claude/plans/[^[:space:]]+\.md` — matches any absolute path ending under `.claude/plans/`, not just one user's home. - Path B Resume Block template: example path is `~/.claude/plans/<slug>.md` with a note to substitute the resolved absolute path emitted by the plan-mode system reminder. Refs: gemini-code-assist review threads on #329 Assisted-by: Claude <noreply@anthropic.com>
Three corrections after review: 1. SKILL.md prose conflated "the plan file" with "the system reminder". The plan file at ~/.claude/plans/<slug>.md is the real document on disk and the canonical store of plan content; the plan-mode <system-reminder> is the deterministic *binding* from session to file, which is what the parallelism-safe lookup needs. Step 0's intro now separates the two concepts and points Step 0a at the binding problem specifically. 2. scripts/cclint-plugins.sh was unnecessary. cclint ships a --staged git-integration mode designed for pre-commit (and a --diff mode for uncommitted changes). It reads files from the git index, detects each file's plugin context (e.g. <plugin>/skills/<name>/SKILL.md), and validates accordingly. Bare `cclint` from the repo root only scans the root-level agents/commands/skills/output-styles dirs and silently misses per-plugin SKILL.md issues — confirmed by injecting `<repo>` into a description and watching `cclint` pass while `cclint --staged` correctly fails. Hook entry is now `cclint --staged`, no wrapper. 3. The trigger glob covered commands/agents, but only skills are an active plugin component in this repo. Glob narrowed to `^[^/]+/(skills/.*\.md$|\.claude-plugin/plugin\.json$)`. Verified by staging a description with literal `<repo>` and attempting `git commit`: hook fails with the exact CI error message and blocks the commit. Reverting the description and re-committing succeeds. Assisted-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/wrap-upnow runs a new Step 0 before the existing cleanup pipeline to decide whether this session's plan is actually done./refresh-repo,/retrospecting quick,/clean_gone, then a forward-looking follow-up prompt.refresh-repowould prune the in-flight worktree — and emits one or more copy-paste Resume Blocks:cd <worktree>plus a self-contained prompt that points at the plan file, lists remaining checklist line numbers + TaskList task IDs, and notes what was already done so a fresh session does not redo work./wrap-up purge-pr <PR>is unchanged and still bypasses Step 0.Why this matters
The prior
/wrap-upassumed the session ended cleanly post-merge. Invoking it mid-plan (context exhaustion, blocker, machine switch) buried unfinished work in the forward-looking follow-up prompt alongside speculative future ideas, which made resuming the exact plan hard. Path B is built for that case.Identifying the current session's plan
Plan identification uses the plan-mode
<system-reminder>already in this session's conversation as the single source of truth — never~/.claude/plans/mtime. mtime races under heavy parallelism (many concurrent sessions on the same machine).TaskListis intrinsically session-scoped by the harness, so it is read directly without disambiguation. The path-matching regex is generic ([^[:space:]]+/\.claude/plans/[^[:space:]]+\.md) so the skill works for every plugin user, not one specific home.URL rule for emitted PR/issue references
Every PR or issue referenced in wrap-up output must use the full
https://github.com/<owner>/<repo>/(issues|pull)/<n>URL on first mention — never bare#123, which forces the reader to guess the repo. Codified in the A4c triage step (capturesgh issue list --json url), the A4d output template, and the Path B Resume Block "must include" list.CI / local-validation change
Added
cclint(github.com/dotcommander/cclint) as a local precommit hook in.pre-commit-config.yaml— this repo only. Mirrors the loop in.github/workflows/validate-plugin.ymlso frontmatter validator failures (e.g. angle brackets indescription) fail at commit time instead of escaping to CI. Uses pre-commit'slanguage: golangso contributors do not need a host Go toolchain — pre-commit installs cclint into an isolated env. Loop logic lives inscripts/cclint-plugins.shper the no-inline-scripts rule.Verified locally: re-injecting
<repo>into the SKILL.md description reproduces the exact CI error message and blocks commit.Commits
be4ed5af204dff<repo>angle brackets from description; URL rule; add cclint precommit hook11700e4Test plan
All verification is human-driven against real Claude Code sessions — no automated tests exist for this skill (it composes other skills + reasoning). CI covers markdown lint, cclint frontmatter validation, and CodeQL.
/wrap-up. Expect identical behavior to today./wrap-up. Expect one Resume Block citing the exact plan path + Path A skipped + incomplete summary.cdpaths and self-contained prompts./wrap-upin session A with A's work incomplete. Expect A's plan path cited, never B's, even though B's file is more recently modified on disk./wrap-up purge-pr <PR>against a throwaway branch. Expect Step 0 bypassed entirely.<foo>into any SKILL.mddescription, runpre-commit run cclint-plugins --all-files, confirm it fails with the Anthropic validator's error message.🤖 Generated with Claude Code