Schritt 8 von 8 - Etwa 35 Min.
Lab 07 - Install into another repository
Time: about 35 minutes. You will: install the flywheel into a fresh repository, read the install manifest, and see how the installer protects files the repository owns or has edited.
Why
A tool that only works in its own repository is a demo. To adopt the flywheel, a repository needs one command that adds it, and a way to upgrade later without losing its memory, its constitution, its OpenSpec settings, or a skill it wrote itself that happens to share a name. "Overwrite everything" breaks the repository; "never overwrite" means upgrades never land. The installer needs to know which copies it put there and whether anyone touched them since.
Concepts
Who owns which file
| Owner | Files | On install |
|---|---|---|
| flywheel | the six skills, three agents, flywheel.py, templates |
copied; upgraded if unchanged |
| repository | .flywheel/config.json, MEMORY.md, constitution.md |
created once, never changed (keep) |
| repository | openspec/config.yaml |
seeded only if it has no custom settings |
| shared | AGENTS.md (marked block), CLAUDE.md (three imports) |
block replaced, imports added once |
The install manifest
.flywheel/install-manifest.json maps each copied path to the sha256 of the copy that was
installed. On the next run, for each flywheel file that already exists:
- identical to the new copy: nothing to do;
- hash matches the manifest (unchanged since the last install):
update; - not in the manifest (the repository's own file):
skip ... not installed by the flywheel; - in the manifest but changed (a local edit):
skip ... edited since the last install.
Any skip makes the exit code 1; everything else is still installed. --force replaces the skipped
files after saving each one as <file>.bak.
OpenSpec first, with project scope
The flywheel does not install OpenSpec. Run openspec init --tools claude --scope project in the
target first. In OpenSpec 2.1.0, init without --scope project puts its workflow skills in your
home folder for every project on the machine. With it, they go to .agents/skills/ in the
repository and are linked into .claude/skills/.
Build
.flywheel/bin/flywheel.py-install(), the_Installerclass (copy(),save()),merge_agents_block(),merge_claude_imports(),_is_default_openspec_config()..flywheel/templates/- everything that is seeded or merged:AGENTS.flywheel.md,constitution.md,flywheel-config.json,openspec-config.yaml.openspec/changes/add-installer/specs/installer/spec.md- the requirements, including the manifest, skips,--force, and unbalanced markers.
Run
From the lab folder:
LAB=$(pwd)
mkdir -p /tmp/flywheel-demo && cd /tmp/flywheel-demo && git init -q
OPENSPEC_TELEMETRY=0 npx -y @fission-ai/openspec@2.1.0 init --tools claude --scope project .
python3 "$LAB/.flywheel/bin/flywheel.py" install . --dry-run
python3 "$LAB/.flywheel/bin/flywheel.py" install .
python3 .flywheel/bin/flywheel.py check
python3 .flywheel/bin/flywheel.py statusThe dry run prints 25 actions (create for each skill, agent, and template, the CLI, the manifest,
the seeded files, AGENTS.md, and CLAUDE.md, plus update .../openspec/config.yaml), ends with
dry run: install: 25 action(s), and writes nothing. After the real install, check passes and
status shows skills: 12 evals: 0: the six flywheel skills plus the six OpenSpec skills linked
into .claude/skills/. Open .flywheel/install-manifest.json and CLAUDE.md.
Run the install again:
keep <repo>/.flywheel/config.json (exists)
keep <repo>/.flywheel/memory/MEMORY.md (exists)
keep <repo>/constitution.md (exists)
install: 3 action(s)
next: python3 .flywheel/bin/flywheel.py check (run inside the target)(<repo> stands for the full path.) The repository's own files are kept, and every
flywheel-owned file is identical, so nothing else is listed. openspec/config.yaml is left alone
too: it is still exactly the template the first install wrote. Once you edit it, later installs
print a note to merge template changes by hand instead of overwriting your edits.
Needs Claude Code and a model: open Claude Code in /tmp/flywheel-demo, ask for a small change,
and watch the context-flywheel skill start with an OpenSpec proposal. The OpenSpec skills call the
openspec command, so install it first (see the prerequisites in the overview).
Break it
Edit an installed skill, then upgrade.
echo "Local edit." >> .claude/skills/evaluate/SKILL.md python3 "$LAB/.flywheel/bin/flywheel.py" install .skip <repo>/.claude/skills/evaluate/SKILL.md (exists, edited since the last install; move it or re-run with --force) ... install: 1 file(s) skipped to protect the repository's own files; nothing else was overwrittenExit code 1. Now force it:
python3 "$LAB/.flywheel/bin/flywheel.py" install . --forcereplace <repo>/.claude/skills/evaluate/SKILL.md (--force; old copy saved as SKILL.md.bak)tail -1 .claude/skills/evaluate/SKILL.md.bakprintsLocal edit..checkignores the.bakfile (it reads*/SKILL.mdonly).A repository with its own
evaluateskill. In a new empty folder, write.claude/skills/evaluate/SKILL.mdyourself, then install:mkdir -p /tmp/flywheel-own/.claude/skills/evaluate && cd /tmp/flywheel-own printf -- '---\nname: evaluate\ndescription: Our own evaluate skill.\n---\nBody.\n' > .claude/skills/evaluate/SKILL.md python3 "$LAB/.flywheel/bin/flywheel.py" install .skip <repo>/.claude/skills/evaluate/SKILL.md (exists, not installed by the flywheel; move it or re-run with --force) note openspec/ not found: run `openspec init --tools claude --scope project` in the target, then re-run install to seed openspec/config.yaml install: 25 action(s) install: 1 file(s) skipped to protect the repository's own files; nothing else was overwritten(The
createlines are left out.) The exit code is 1, your file is unchanged, and the manifest does not list it, so the next install skips it again.--forcewould replace it and keep your version asSKILL.md.bak; renaming your skill is usually the better fix.Unbalanced markers. In another empty folder, write an
AGENTS.mdwith<!-- context-flywheel:start -->and no end marker, then install:mkdir -p /tmp/flywheel-markers && cd /tmp/flywheel-markers printf '# AGENTS.md\n\n<!-- context-flywheel:start -->\n' > AGENTS.md python3 "$LAB/.flywheel/bin/flywheel.py" install .error: AGENTS.md has unbalanced flywheel markers; keep exactly one <!-- context-flywheel:start --> ... <!-- context-flywheel:end --> pair (or none) and re-run installExit code 2 and
AGENTS.mdis unchanged. The files copied before that point (.claude/,.flywheel/,constitution.md) stay; fix the markers and re-run to finish.
Check
cd "$LAB"
python3 -m unittest tests.test_flywheel.TestInstaller -vEleven tests, including test_never_overwrites_a_repository_skill_with_the_same_name,
test_upgrade_replaces_unedited_copies_and_keeps_edited_ones,
test_unbalanced_agents_markers_are_refused, and test_reinstall_is_idempotent_and_keeps_owned_files.
Exercises
- Simulate an upgrade: in the demo repository, change one line of
.flywheel/bin/flywheel.pyand put that file's new sha256 in the manifest (shasum -a 256). Re-install. Which line does the installer print for it, and why is that safe? - Write a rule for your own project under
## Project rulesin the demo'sconstitution.md, then re-install. Confirm it was kept. - The installer copies only flywheel-owned files. List what you would add for a team of five
(shared memory scope, CI running
checkandopenspec validate), and which of those the "Version 1 scope" section of docs/README.md says is not included yet.
Exam connection
CCA-F - Claude Code Configuration & Workflows (project versus machine-wide skills, CLAUDE.md
imports, rolling a workflow out to another repository) and Tool Design & MCP Integration (a tool
that is safe by default: dry run, clear per-file actions, distinct exit codes, an explicit
--force with backups). Practice both on CertLabPro,
and keep going on your phone with the CertLabPro app.
You finished the lab. The flywheel is now in a second repository; the next lesson it captures is yours.
Previous: Lab 06 - Compaction - Next: Overview