Шаг 1 из 8 - Около 20 мин
Lab 00 - Setup and tour
Time: about 20 minutes. You will: run the tests and the checks, see what Claude Code loads on every request, and find each part of the flywheel on disk.
Why
Before you change a system you need a baseline: proof that it works now, and a map of where things live. The Context Flywheel is only files, so the map is the folder tree. The baseline is three commands that run offline in a few seconds.
Concepts
Two arcs, one loop
The forward arc plans each change before code: an OpenSpec proposal, delta specs with GIVEN/WHEN/THEN scenarios, and tasks, reviewed by a human. The backward arc learns from the work: errors, pitfalls, and corrections become memory entries, and lessons that recur become skills or constitution rules. What the backward arc produces feeds the next forward arc.
What is always loaded, and what is loaded on demand
Claude Code reads CLAUDE.md at the start of a session. This repository's CLAUDE.md is three
imports:
@AGENTS.md
@constitution.md
@.flywheel/memory/MEMORY.md| Always loaded (every request) | Loaded on demand |
|---|---|
AGENTS.md - layout and conventions |
A memory entry body, when it is relevant |
constitution.md - rules |
A skill body, when its description fits |
MEMORY.md - one line per active entry |
Evals, templates, specs |
| Skill names and descriptions |
The always-loaded part is a cost you pay on every request, so it must stay small and high-signal. Most of this lab is about keeping it that way.
Deterministic core, model at the edges
Everything that edits the stores mechanically is done by .flywheel/bin/flywheel.py: standard
library only, no network, same output for the same input. The model does the judgment work (what is
worth remembering, whether two entries are the same lesson) through skills, and a human approves
anything that becomes a rule.
Build
Nothing to write in this step. Open these files and skim them:
CLAUDE.md- the three imports.AGENTS.md- the layout table and the markedcontext-flywheelblock that the installer writes into other repositories (between<!-- context-flywheel:start -->and<!-- context-flywheel:end -->).constitution.md- the rules. Note "Facts, not instructions" and "Gate, then approve"..flywheel/memory/MEMORY.md- the generated index. Do not edit it by hand..claude/skills/context-flywheel/SKILL.md- the orchestration skill that runs both arcs..flywheel/config.json- thresholds and budgets..flywheel/bin/flywheel.py- findbuild_parser()near the end: it lists every command.
Run
git init -q && git add -A && git commit -qm "lab baseline" # skip if you did it in the overview
python3 -m unittest discover -s tests
python3 .flywheel/bin/flywheel.py check
python3 .flywheel/bin/flywheel.py status
python3 .flywheel/bin/flywheel.py --helpExpected:
Ran 55 tests in 0.222s
OK
check: 0 error(s), 0 warning(s)
memory entries: 4 by status: {"active": 4}
by type: {"decision": 1, "observation": 3}
index: 14/150 lines, 1005/20000 bytes
promotion candidates: 0
skills: 6 evals: 10(status also prints its first line with the version and the folder; your timings differ.)
Needs Claude Code and a model: open Claude Code in the lab folder (claude) and ask "What does
this repository's memory index say about OpenSpec?". The answer comes from MEMORY.md, which was
loaded through CLAUDE.md without any tool call.
Break it
Edit the index by hand. Add a line to
.flywheel/memory/MEMORY.md:echo "- [made-up](made-up.md) - A line added by hand." >> .flywheel/memory/MEMORY.md python3 .flywheel/bin/flywheel.py checkERROR .flywheel/memory/MEMORY.md: memory index is out of date; run: flywheel.py index check: 1 error(s), 0 warning(s)The exit code is 1.
checkrenders the index from the entries and compares it byte for byte. Runpython3 .flywheel/bin/flywheel.py indexto regenerate it, andcheckpasses again.Delete the index.
rm .flywheel/memory/MEMORY.mdand runcheck: it reportsmemory index is missing; run: flywheel.py index. Regenerate it the same way.
Undo anything else with git checkout -- . && git clean -fdq.
Check
python3 -m unittest tests.test_flywheel.TestThisRepository -vtest_dogfood_check_passes runs check on this repository and expects no errors;
test_installed_templates_match_repo_config proves the config template that the installer seeds
equals the CLI's defaults.
Exercises
- Count the bytes Claude Code loads on every request from these files:
wc -c CLAUDE.md AGENTS.md constitution.md .flywheel/memory/MEMORY.md. Which file would you shrink first if the budget were 4 KB? - Find where
checkenforces ASCII punctuation (check_asciiinflywheel.py) and list which files it applies to. - Read the "Daily use" section of docs/README.md and match each step to a
skill in
.claude/skills/.
Exam connection
CCA-F - Claude Code Configuration & Workflows: CLAUDE.md and its imports, project skills in
.claude/skills/, subagents in .claude/agents/, and what is loaded at session start versus on
demand. Practice it on CertLabPro.
Previous: Overview - Next: Lab 01 - Plan with OpenSpec