Moves a project's state from an older version of the Metaproject
standard to the current one. Unlike update, which
synchronises content within the same version, upgrade
changes the state's structure and conventions.
Upgrades are cumulative: each hop between
consecutive versions (v1 → v2, v2 → v3, etc.) lives in its own
upgradeN-M.md. The orchestrator below detects the state's
current version and applies the hops in sequence until the state is at
the current standard.
Read /home/claude/state/setup.md and look for the
marker:
*Metaproject standard: vN.*
This line appears near the top, under the title. A state set up by hand may name its version in a sentence instead (in its working language, say "standard v3 of the metaproject"): take that version, and write the marker line when the upgrade is done. If neither is there, the state predates versioning — treat it as v1.
Some states carry a hybrid marker of the form
*Metaproject standard: v3 + reinjection-proof startup (…).*
These adopted the v5 startup and closing rules by hand before v5
existed, copying them from another project. Treat them as
v3: apply upgrade3-4 as usual, and
upgrade4-5 will recognise what is already in place and
complete only what is missing. A state may be in the same case with a
plain v3 marker (or a version named in a sentence): what
gives it away is a closing/readme.md with a guarded unzip,
or a closing protocol that archives by copy. Treat it the same way.
The current version of the standard is recorded in two redundant channels that must agree:
The hops. The upgradeN-M.md files
sitting next to this document. List them:
ls /path/to/metaproject/upgrade*-*.mdEach file name has the shape upgradeN-M.md, meaning
"takes the state from vN to vM". The current version derived from this
channel is the highest M among the available hops.
The setup templates. The line
*Metaproject standard: vN.*
near the top of both templates/setup-standalone.md and
templates/setup-external.md. Both templates must declare
the same N.
Coherence check. Before doing anything else, verify
that the three numbers agree: max(hops), the N in
setup-standalone.md, and the N in
setup-external.md. If any of the three diverges,
stop immediately and report the divergence to the user.
Do not attempt to pick a winner — the divergence is the bug, and the fix
belongs upstream in Metaproject, not in this operation.
When the three agree, that number is the current version of the
standard. If the state is already at the current version, there is no
hop to apply — tell the user. A maintenance release of the same version
may still have changed the templates since the state was brought to this
version, so propose running audit.md with its
Fixing step instead: it compares the state with the current
templates and fixes, with the user's approval, what it finds.
Working language. Ask the user what language they want to work in. Default is English. The state's files may already be in more than one language (English files, a startup readme in the user's language, say): unless the user says otherwise, keep each file in the language it is in, and rewrite it from the template in that language.
Detect current version as described above. Tell the user what was found.
Discover the current standard by listing
upgradeN-M.md in Metaproject, reading the version marker in
both setup templates, and verifying that the three agree as described
above. If they diverge, stop and report.
Plan the chain of hops from the project's
current version to the current standard. If the project is at v1 and the
standard is v5, the chain is
upgrade1-2 → upgrade2-3 → upgrade3-4 → upgrade4-5. Show
the chain to the user before executing.
Execute each hop in order. For each, read the
corresponding upgradeN-M.md and follow its instructions.
After each hop:
setup.md to the new
version.Propose running update. After the
final hop, the state is structurally at the current standard
but its distributed content (the skills) may not yet be — only
update synchronises that. Propose to the user running
update now, in the same session.
If the user agrees, execute update.md before
closing.
If the user prefers to do it another time, write an entry in
/home/claude/state/pending-tasks.md (create the file if it
does not exist) of the form:
- Run `update` to complete the upgrade vN→vM.
where vN and vM are the original and final versions of this upgrade. Also mention it in the handoff.
Close the session with the usual protocol:
archive the current handoff, write a new one describing the upgrade (and
the deferred update if applicable), and package, all as the closing
protocol in setup.md says.
upgradeN-M.md assumes the state is at vN and leaves it
exactly at vM. It does not skip versions. The one allowance: a hop may
recognise pieces of vM that a state adopted by hand ahead of time, and
then completes only what is missing (see the hybrid marker above).