/peak-workflow:upgradefrom peak-workflow
Upgrades a project's peak-workflow files to the format this plugin version reads, running numbered steps on a dedicated branch with one commit per step.
Ships in peak-workflow. 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.
You are upgrading this project's peak-workflow files to the format this plugin reads. The steps
live in ${CLAUDE_PLUGIN_ROOT}/skills/upgrade/steps/NNNN-<name>.md. Each one is forward-only:
it has a Detect check, a Preview to show the user, an Apply, and optionally a
Report for the final message. Applying step NNNN moves the project to format NNNN. You run the steps; you do not improvise changes they do not
describe, and no step ever edits the user's CLAUDE.md.
tor-lifecycle below means sh "${CLAUDE_PLUGIN_ROOT}/scripts/tor-lifecycle". Exit codes: 0 ok,
1 findings, 2 data error (relay stderr and stop), 3 no suitable Python (relay the install hint and
stop).
Run tor-lifecycle format (exit 3: print the install hint and stop; exit 2: print the error and
stop) and act on its first line, verdict: <word>:
| Verdict | Action |
|---|---|
new | Print "No peak-workflow files here yet. Run /peak-workflow:setup — it stamps the current format." and stop |
ahead or not-peak-workflow | Print the command's message and stop |
current or behind | Continue. N is the project: number (0 when there is no stamp) |
Run git status --porcelain. If it lists anything, stop: "Commit or stash your changes first —
each upgrade step is its own commit, and yours must not ride along."
Then pick the base branch: git branch --list develop main master — prefer develop, then
main, then master. Every <base> below is this branch. B is the base's own format — N as
read in Step 1 when you are on <base>, else git show <base>:docs/.peak-workflow.toml 2>/dev/null
(format = …; no file = 0 — git's "exists on disk, but not in" message is expected then, so it is
silenced). The plan heading, the summary, and the Leave message name B, not a
half-upgraded branch's number.
Resume check. Unless you are already on one, look for an earlier run's branch:
git branch --list 'docs/upgrade-*', keeping those that have not merged (git merge-base --is-ancestor <branch> <base> fails and git cherry <base> <branch> prints a + line). When
there is one, say "Resuming the upgrade on (started in an earlier session).", check it
out, and re-run Step 1 — the format, and so the work left, are read from that branch. A resumed
run skips Step 5 (the in-flight question was answered when the branch was made; its skips are
whatever that run's Detects still report).
List ${CLAUDE_PLUGIN_ROOT}/skills/upgrade/steps/*.md. Two kinds of work:
N, in ascending order. The target is the last one's
number.N or below whose Skip line says skipping is supported. An
earlier run may have skipped epics that were in flight; once those merge, the step's Detect
finds them. Run each such Detect now, without skips; pending output is catch-up work. (Step 6
runs it again with any Step 5 skips.) When there are no pending steps and every catch-up path
names an epic (status/epic-<id>.md, phase-*/epic-<id>-*.md) that some row of
tor-lifecycle inflight --base <base> '<the step's Rewrites patterns>' also names (that epic's
branch is still unmerged), print "Catch-up for waits until merge."
and stop — there is nothing to apply yet.Then:
<base> (B is below N), print "Every step is applied on , but is still on
format B." and go to Step 7: its summary lists that branch's commits as "(earlier run)", and its
merge question comes back. The heading's <target> is N. Otherwise print "This project is on format N — nothing to
upgrade." and stop.Read each step file involved. Show the plan:
Upgrade: format B → <target> (or: catch-up on format N)
| Step | What it does |
|---|---|
| 0001 epic-provenance | <the step's Summary line> | ← mark catch-up rows "(catch-up)"
docs/upgrade-format-<target>, or docs/upgrade-catch-up-<N> when
there is only catch-up work — <target> and <N> as plain integers (docs/upgrade-format-2,
never -0002).git checkout <base>. If git rev-parse --abbrev-ref @{upstream} 2>/dev/null succeeds, run
git pull --ff-only; on failure, stop and say the base has diverged from origin.git checkout -b <branch>. If that branch already exists and has merged —
git merge-base --is-ancestor <branch> <base> succeeds, or git cherry <base> <branch> prints
no + line (a squash or rebase merge) — it is an earlier run's branch: git branch -D <branch>
and create it again. If it exists and has not merged, ask via
AskUserQuestion — ["Continue on the existing branch", "Stop"]; on Continue check it out and
re-run tor-lifecycle format (an earlier run may have applied some steps; recompute the pending
list).Collect every pattern in the Rewrites lines of the steps you will run and run
tor-lifecycle inflight --base <base> '<pattern>' …, each pattern single-quoted so git (not the
shell) matches it on every branch. It prints branch<TAB>path for each unmerged
local or remote branch that touches them (exit 0 = none; skip the rest of this step).
When there are rows, show them grouped by branch and explain in one sentence: those branches will
conflict with this upgrade where they edit the same lines. For a branch that touches
docs/requirements/, add: after it merges <base> in, every requirement it edited needs
/peak-workflow:capture-requirements <TOR> before it can merge (the upgrade turned those edits
into unrecorded changes against the recorded history). And a clean merge is not proof of a good
one: a branch that added a line the upgrade also added (a second owner:) merges silently, and
then every command stops with a "owner: appears twice" data error until one line is deleted.
Then ask via AskUserQuestion.
Offer the Skip option only when the listed paths name epics (status/epic-<id>.md,
phase-*/epic-<id>-*.md) and at least one step you will run says skipping is supported —
otherwise the first option is "Rewrite everything anyway (Recommended)". When some steps
support skipping and others do not, name the others in the question — they still rewrite the
skipped epics' files:
"Some branches in flight touch files this upgrade rewrites. How should I proceed?""Skip the epics those branches work on (Recommended)" — collect the epic IDs from the listed
paths (status/epic-<id>.md, phase-*/epic-<id>-*.md) and pass them to every step whose
Skip line says it supports skipping. Tell the user to re-run /peak-workflow:upgrade after
those epics merge — the detect check picks up exactly what was skipped."Rewrite everything anyway""Stop — I'll merge or finish those branches first" — then git checkout <base> && git branch -D <branch> (nothing was committed on it).A skipped epic does not hold the stamp back: the step's change is optional history for in-flight epics, and its detect check stays honest on the next run.
First the catch-up steps, then the pending steps, in ascending order. A catch-up step is applied
exactly like a pending one except: skip item 4 (the stamp already covers it), and its commit
message ends in (catch-up).
For each step:
AskUserQuestion:
"Apply step NNNN <name>?" — ["Apply", "Stop here"]. On Stop, end the session: the branch
keeps the steps already committed, and a later run resumes from the stamp.tor-lifecycle format --set NNNN.git branch --show-current first). Stage the
files the step changed since its last commit and docs/.peak-workflow.toml by path, never
git add -A: git commit -m "chore(upgrade): step NNNN <name>". Then git status --porcelain
must be empty; if anything is left over, stop and show it.Run tor-lifecycle format and print its message (it says current). Then summarize (a
catch-up-only run: heading Caught up format N on <branch>), one row per commit on the branch,
oldest first (git log --reverse --format='%h %s' <base>..HEAD), marking those an earlier session
made "(earlier run)":
Upgraded format B → <target> on <branch>
| Commit | Step | Files |
|---|---|---|
| <sha7> | 0001 epic-provenance | <count> |
| <sha7> | 0002 requirements-lifecycle — change records | <count> |
A commit whose subject names no step (made by hand) is labelled with its own subject. <count>
is the number of files in the commit, the stamp included (git show --name-only --format= <sha>).
Then, for each step applied in this run that has a Report section, do what it says — in this message (a step may also save a full listing to a file it names).
List any skipped epics with "re-run /peak-workflow:upgrade after these merge". If the branch has no
commit at all (git log <base>..HEAD is empty), delete the empty branch (git checkout <base> && git branch -d <branch>), say
there was nothing to apply, and stop.
Merge is approval, as for every docs/ branch. Ask via AskUserQuestion:
Question: "How should <branch> reach <base>?"
Options: ["Team — push and open a PR", "Solo — merge into <base> locally", "Leave the branch for now"]
Team: git push -u origin <branch>, then
gh pr create --base <base> --title "chore(upgrade): format B → <target>" (catch-up only:
"chore(upgrade): catch-up on format N") with the summary table as the body.
Solo: git checkout <base> && git merge --no-ff <branch> && git branch -d <branch>.
Leave: print the two commands above for later, and say: "Until it merges, is still on format B — start no epic and run no other command that changes files there."
After a merge, remind the user that branches in flight should merge <base> in before they
continue.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
15 skills in this plugin
/addAdds new epic(s) to the implementation plan from a natural language description.
Epics reference TOR requirement IDs from docs/requirements/*.feature.md as their Requirements
Anchors — the TOR ID is the acceptance criterion and the Given/When/Then is the verification.
Use when the user wants to add a single epic or small batch without re-running full planning.
Triggers on: "add epic", "new epic", "create epic", "I need to add more work",
"there's a new feature we need", "can we squeeze in", "add a feature",
"another thing we need to build".
/capture-requirementsDerives formal Gherkin-style TOR requirements (.feature.md files) from product-vision.md and
concept-of-operations.md. Main agent adopts a seasoned-PM persona to author feature files
autonomously; Haiku sub-agent verifies traceability and writes .feature.tracing.json sidecars.
Changes to merged requirements (reword, supersede, retire, record as pending, uphold) each leave a
Change Record in docs/requirements/changes/. With a TOR ID argument it amends that one
requirement (e.g. one that changed since it was verified, or one known to be wrong).
User reviews via the docs/ branch and merge — there is no inline interview.
Run after /peak-workflow:discover and before /peak-workflow:plan-project.
Triggers on: "capture requirements", "derive requirements", "write feature files",
"create TOR requirements", "formalize requirements", "establish requirements baseline",
"generate TOR IDs", "requirements capture", "amend requirement", "retire requirement",
"supersede requirement".
npx claudepluginhub peakflames/claude-plugins-peakflames --plugin peak-workflowOther plugins' skills for the same job