From 0d30052eee4f13105bd401c27dc9ea2f1a09e752 Mon Sep 17 00:00:00 2001 From: Focus Date: Thu, 5 Nov 2026 11:37:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=96=20docs=20(workflow):=20distill?= =?UTF-8?q?=20first=20principles=20into=20design=20and=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- book/README.md | 5 ++- ...ill-first-principles-into-design-phases.md | 37 +++++++++++++++++++ book/guidelines/README.md | 2 +- book/guidelines/review-checklist.md | 3 +- book/guidelines/workflow.md | 4 +- skills/boscope/SKILL.md | 8 +++- 6 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 book/docs/decisions/ADR-005-distill-first-principles-into-design-phases.md diff --git a/book/README.md b/book/README.md index dc6196d..3ed89c9 100644 --- a/book/README.md +++ b/book/README.md @@ -52,6 +52,7 @@ description: Master index of the book — the map of every document. Regenerate - [ADR-002-adopt-bowrite.md](docs/decisions/ADR-002-adopt-bowrite.md) — We distill shuorenhua and human-writing plus our own review patterns into bowrite (薄写), an in-repo writing skill — write thin, write well - [ADR-003-intent-gates-vs-distrust-gates.md](docs/decisions/ADR-003-intent-gates-vs-distrust-gates.md) — We classify workflow gates by justification — intent gates stay hard, distrust gates soften as models improve; Phase 2 approval becomes gap-based stopping - [ADR-004-template-free-of-instance-records.md](docs/decisions/ADR-004-template-free-of-instance-records.md) — This repository ships template content only — instance working records (notes entries, plans, changelog months) never enter it; a release check enforces the boundary +- [ADR-005-distill-first-principles-into-design-phases.md](docs/decisions/ADR-005-distill-first-principles-into-design-phases.md) — Musk's first-principles engineering method is woven into the design phases — requirements face a physics test, estimates derive bottom-up, deletion precedes optimization - [README.md](docs/decisions/README.md) — How to write an ADR here — sections, naming, numbering, and when a decision needs a record ### guidelines/ @@ -60,7 +61,7 @@ description: Master index of the book — the map of every document. Regenerate - [architecture.md](guidelines/architecture.md) — Template for your project's long-term architecture rules — boundary invariants, module map, tech baseline, with a worked example of boundary-style rules - [coding-style.md](guidelines/coding-style.md) — Template for your project's coding baseline — the language-specific rules any contributor or agent must follow - [git-workflow.md](guidelines/git-workflow.md) — Clean Commit message format and Clean Flow branch, PR, and merge rules for solo and team development -- [review-checklist.md](guidelines/review-checklist.md) — The eight code-review checks every change must pass — findings are recorded, never fixed in passing +- [review-checklist.md](guidelines/review-checklist.md) — The nine code-review checks every change must pass — findings are recorded, never fixed in passing - [workflow.md](guidelines/workflow.md) — Six-phase gate workflow with the eight code↔book interaction rules and the document routing table - [writing-style.md](guidelines/writing-style.md) — Plain-language writing standard for every book document — fidelity contract first, then minimal style rules, intensity levels, and a read-back check @@ -72,4 +73,4 @@ description: Master index of the book — the map of every document. Regenerate - [README.md](plans/README.md) — Plans directory usage — implementation plans land here after Phase 2 approval, with naming and the plan template - + diff --git a/book/docs/decisions/ADR-005-distill-first-principles-into-design-phases.md b/book/docs/decisions/ADR-005-distill-first-principles-into-design-phases.md new file mode 100644 index 0000000..d9d585b --- /dev/null +++ b/book/docs/decisions/ADR-005-distill-first-principles-into-design-phases.md @@ -0,0 +1,37 @@ +--- +description: Musk's first-principles engineering method is woven into the design phases — requirements face a physics test, estimates derive bottom-up, deletion precedes optimization +--- + +# ADR-005: Distill first principles into the design phases + +## Status + +Accepted — 2026-11-05. Ships with the template. + +## Context + +The workflow's weakest spot sits upstream of code: requirements, estimates, and designs arrive by analogy — "how it's done", "the last similar feature took three days", a vendor's defaults — and get inherited without a challenge. Nothing in the six phases asked whether a requirement was law or habit. + +The distilled material is Elon Musk's public engineering reasoning (interviews and talks, gathered 2026-11): + +- **Physics is the law; everything else is a suggestion.** Battery packs "had to" cost about $600/kWh — until the materials (cobalt, nickel, aluminum, carbon) were priced at London Metal Exchange spot rates, giving a theoretical floor near $80/kWh. The gap was in manufacturing, not materials. Rockets built from raw materials running 1–2% of the traditional price pointed at the process, not the physics. +- **The five-step algorithm, in order**: question every requirement → delete (if you never add back ~10%, you're not deleting enough) → simplify → accelerate → automate — automating a wasteful process is faster waste. +- **Iterate fast, let it fail**: "if things aren't failing, you aren't innovating enough" — rapid, public iteration beats polishing in private. + +## Decision + +Weave the method into the existing design-development flow rather than shipping a fifth skill. The method fires at phase boundaries — Step 0, Phase 2, Phase 4 — and a standalone skill would trigger beside the workflow instead of inside it. + +- **Step 0** (boscope): every requirement faces the physics test. Correctness, data integrity, the user's explicit hard constraints, and real resource limits don't negotiate; convention and inherited HOWs do. The user's WHAT is physics; the HOW is suggestion. +- **Phase 2**: designs and estimates derive bottom-up from primitives, never by analogy; the gap between the bottom-up answer and the received number marks the real problem. Delete what no requirement calls for, then simplify, and only then optimize. +- **Phase 4**: the test-first loop is the iteration engine — a red test is data, not a setback. Iterate freely inside the phase, never past the gate. +- `guidelines/workflow.md` carries the what/why sentences; `guidelines/review-checklist.md` gains the ninth check — parts that trace to no requirement. + +What stays out, deliberately: the attitude layer (extreme work hours, ego reduction, "be useful before impressive"), management practices, and Ad Astra — engineering method only, and the skills and guidelines stay thin. + +## Consequences + +- boscope gains about ten lines of method; adopters maintaining translated or local variants of the skill sync the same insertions +- "Question the requirement" never licenses overriding the user — it separates the user's WHAT (physics) from inherited HOWs (suggestions); the Phase 2 approval gate is unchanged +- Review now catches gold-plating explicitly instead of folding it into "complexity added" +- Re-audit with model generations per ADR-003: a model that questions inherited requirements reliably on its own may let the Step-0 duty shrink diff --git a/book/guidelines/README.md b/book/guidelines/README.md index 671f00f..e9578a8 100644 --- a/book/guidelines/README.md +++ b/book/guidelines/README.md @@ -11,7 +11,7 @@ The project's development rules. Every contributor — including AI agents — f | `workflow.md` | Six-phase gate workflow and the code↔book interaction rules | | `writing-style.md` | Plain-language standard for every book document | | `git-workflow.md` | Clean Commit format and Clean Flow branch/PR/merge rules | -| `review-checklist.md` | The eight code-review checks | +| `review-checklist.md` | The nine code-review checks | | `architecture.md` | Long-term architecture rules (template — replace per project) | | `coding-style.md` | Language-specific coding baseline (template — replace per project) | diff --git a/book/guidelines/review-checklist.md b/book/guidelines/review-checklist.md index e0ab439..170a42a 100644 --- a/book/guidelines/review-checklist.md +++ b/book/guidelines/review-checklist.md @@ -1,5 +1,5 @@ --- -description: The eight code-review checks every change must pass — findings are recorded, never fixed in passing +description: The nine code-review checks every change must pass — findings are recorded, never fixed in passing --- # Code review checklist @@ -13,6 +13,7 @@ description: The eight code-review checks every change must pass — findings ar - [ ] Missed notifications (where the design calls for one) - [ ] Missed boundaries (input ranges / empty values / extremes) - [ ] Complexity added +- [ ] Parts that trace to no requirement (delete before optimize) - [ ] Changes outside the approved scope ## Principle diff --git a/book/guidelines/workflow.md b/book/guidelines/workflow.md index e093b9e..00744cb 100644 --- a/book/guidelines/workflow.md +++ b/book/guidelines/workflow.md @@ -18,9 +18,9 @@ Every feature moves through these phases in order. **No skipping.** | Phase 5 | Code review | Review findings | Record only — no fixes | | Phase 6 | Wrap-up | Docs, learnings, issues | Record only — no fixes | -Step 0 comes before any code. Fill the brief: background, scope (what it affects, what it explicitly does **not** affect, and the boundaries), and the requirement itself. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3 — the exclusions slot is required. +Step 0 comes before any code. Fill the brief: background, scope (what it affects, what it explicitly does **not** affect, and the boundaries), and the requirement itself. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3 — the exclusions slot is required. Requirements arrive as suggestions; physics is the only law — correctness, data integrity, and the user's explicit hard constraints don't negotiate, while convention, past practice, and "how it's done" do. Question the inherited HOW; the user's WHAT holds (reasoning and sources in [ADR-005](../docs/decisions/ADR-005-distill-first-principles-into-design-phases.md)). -Phase 2 produces the full design — data flow, file list, interfaces — and proceeds; it stops for the user only when a real gap appears (scope conflict, undetermined data shape, unclear external dependency), never just for confirmation. +Phase 2 produces the full design — data flow, file list, interfaces — and proceeds; it stops for the user only when a real gap appears (scope conflict, undetermined data shape, unclear external dependency), never just for confirmation. Designs and estimates derive bottom-up from primitives — what the data and code actually are — never by analogy to last time; delete what no requirement calls for before optimizing anything that remains. Phase 4's hard part is the gate, not the sequence: all relevant tests green, no assertion weakened to get there, coverage of the normal path, boundary inputs (ranges, empty, extremes), error paths, and a regression check that existing behavior didn't break. Test-first (write a failing test → minimum implementation → refactor staying green) is the default loop — sequence the work however keeps the gate honest. diff --git a/skills/boscope/SKILL.md b/skills/boscope/SKILL.md index 5caa769..d6b6218 100644 --- a/skills/boscope/SKILL.md +++ b/skills/boscope/SKILL.md @@ -23,6 +23,8 @@ Render the brief below and fill every slot. For empty slots you have two duties: **B. Sufficient → recommend.** Once enough is known to start, don't stop — raise the design axes the user didn't mention (permissions, notifications, idempotency, caching, transactions, boundaries, regression, generated-artifact sync…). Mark each as `[recommended — confirm or reject]`. Fill the gaps the user didn't know were there. +**C. Inherited → question.** Every requirement is a suggestion until it shows its law — physics is the law, everything else negotiates. Physics here: correctness, data integrity, the user's explicit hard constraints, real resource limits. Suggestions wearing physics clothes: "how it's done", industry habit, past practice, third-party defaults. The user's WHAT is physics; the HOW is suggestion — question what was inherited, never what was asked. + ### Brief template ``` @@ -56,6 +58,10 @@ Understand the requirement → find the relevant code → trace the call chain **Output:** data flow, sequence diagram (optional), file change list, new interfaces, permission design, notification design, test points. +**Derive, don't analogize.** Design and estimate bottom-up: decompose to primitives — what the data actually is, what the code actually does, measured costs — and reason up from there. An analogy ("the last similar feature took three days") is a data point, not an estimate. A gap between the bottom-up answer and the received number marks the real problem. + +**Delete before you optimize.** Question every part against its requirement: delete what nothing calls for, simplify what remains, and only then optimize or speed up. If nothing ever gets added back, you're deleting too little; optimizing a part that shouldn't exist is waste, faster. + **Stop and wait for approval.** Do not enter Phase 3 until the user explicitly approves. (A kickoff message that clearly orders implementation and sets the technical context counts as approval — record that basis in the plan.) > **Permissions + notifications** are the two slots agents forget most. Even when the answer is "not needed this time", state it explicitly. @@ -68,7 +74,7 @@ Strictly per the approved design. **No changes outside scope, no refactors, no n ### Phase 4: Testing (test-first) -Write a failing test → write the minimal implementation that passes → refactor with tests green. +Write a failing test → write the minimal implementation that passes → refactor with tests green. This loop is the iteration engine — run it fast and let it fail: a red test is data, not a setback. Iterate freely inside the phase, never past the gate. **Coverage (all required):** normal path · permission checks · boundaries (input ranges / empty / extremes) · error paths · regression (existing behavior intact). From 3a82f52a33ed34525c33965483dacffee9a6019d Mon Sep 17 00:00:00 2001 From: Focus Date: Thu, 5 Nov 2026 11:46:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=96=20docs=20(workflow):=20distill?= =?UTF-8?q?=20experience-first=20design=20into=20the=20phases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- book/README.md | 5 ++- ...ill-experience-first-design-into-phases.md | 38 +++++++++++++++++++ book/guidelines/README.md | 2 +- book/guidelines/review-checklist.md | 3 +- book/guidelines/workflow.md | 6 +-- skills/boscope/SKILL.md | 10 +++-- 6 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 book/docs/decisions/ADR-006-distill-experience-first-design-into-phases.md diff --git a/book/README.md b/book/README.md index 3ed89c9..87bce1b 100644 --- a/book/README.md +++ b/book/README.md @@ -53,6 +53,7 @@ description: Master index of the book — the map of every document. Regenerate - [ADR-003-intent-gates-vs-distrust-gates.md](docs/decisions/ADR-003-intent-gates-vs-distrust-gates.md) — We classify workflow gates by justification — intent gates stay hard, distrust gates soften as models improve; Phase 2 approval becomes gap-based stopping - [ADR-004-template-free-of-instance-records.md](docs/decisions/ADR-004-template-free-of-instance-records.md) — This repository ships template content only — instance working records (notes entries, plans, changelog months) never enter it; a release check enforces the boundary - [ADR-005-distill-first-principles-into-design-phases.md](docs/decisions/ADR-005-distill-first-principles-into-design-phases.md) — Musk's first-principles engineering method is woven into the design phases — requirements face a physics test, estimates derive bottom-up, deletion precedes optimization +- [ADR-006-distill-experience-first-design-into-phases.md](docs/decisions/ADR-006-distill-experience-first-design-into-phases.md) — Jobs's experience-first craft is woven in beside ADR-005 — the request is a proxy for an experience, design is how it works, focus is saying no, and gates are the polish point - [README.md](docs/decisions/README.md) — How to write an ADR here — sections, naming, numbering, and when a decision needs a record ### guidelines/ @@ -61,7 +62,7 @@ description: Master index of the book — the map of every document. Regenerate - [architecture.md](guidelines/architecture.md) — Template for your project's long-term architecture rules — boundary invariants, module map, tech baseline, with a worked example of boundary-style rules - [coding-style.md](guidelines/coding-style.md) — Template for your project's coding baseline — the language-specific rules any contributor or agent must follow - [git-workflow.md](guidelines/git-workflow.md) — Clean Commit message format and Clean Flow branch, PR, and merge rules for solo and team development -- [review-checklist.md](guidelines/review-checklist.md) — The nine code-review checks every change must pass — findings are recorded, never fixed in passing +- [review-checklist.md](guidelines/review-checklist.md) — The ten code-review checks every change must pass — findings are recorded, never fixed in passing - [workflow.md](guidelines/workflow.md) — Six-phase gate workflow with the eight code↔book interaction rules and the document routing table - [writing-style.md](guidelines/writing-style.md) — Plain-language writing standard for every book document — fidelity contract first, then minimal style rules, intensity levels, and a read-back check @@ -73,4 +74,4 @@ description: Master index of the book — the map of every document. Regenerate - [README.md](plans/README.md) — Plans directory usage — implementation plans land here after Phase 2 approval, with naming and the plan template - + diff --git a/book/docs/decisions/ADR-006-distill-experience-first-design-into-phases.md b/book/docs/decisions/ADR-006-distill-experience-first-design-into-phases.md new file mode 100644 index 0000000..42a9667 --- /dev/null +++ b/book/docs/decisions/ADR-006-distill-experience-first-design-into-phases.md @@ -0,0 +1,38 @@ +--- +description: Jobs's experience-first craft is woven in beside ADR-005 — the request is a proxy for an experience, design is how it works, focus is saying no, and gates are the polish point +--- + +# ADR-006: Distill experience-first design into the phases + +## Status + +Accepted — 2026-11-05. Ships with the template. + +## Context + +[ADR-005](ADR-005-distill-first-principles-into-design-phases.md) wired first-principles reasoning into the phases — physics tests, bottom-up estimates, delete before optimize. That method reasons from constraints inward. The complementary direction was missing: reasoning from the user's experience outward. + +The distilled material is Steve Jobs's public product philosophy (interviews and talks, gathered 2026-11): + +- **Technology alone is not enough** — "it's technology married with liberal arts... that makes our hearts sing": the deliverable is judged by the experience it produces, not the mechanism it uses. +- **Design is how it works, not how it looks** — the surfaces a person touches are the design. +- **It's not the customer's job to know what they want** — the stated request is a proxy for an experience; taste builds what people can't leave once they've had it (Macintosh, iPod, iPhone, iPad). +- **Focus is saying no; polish to near-perfection before release** — simplicity, concentration, finishing before shipping. + +## Decision + +Weave the method into the same phase boundaries as ADR-005. The two philosophies pair rather than collide: Musk reasons from physics inward, Jobs from experience outward; both converge on ruthless deletion — ADR-005 calls it the algorithm's second step, Jobs calls it focus. The apparent tension — iterate fast (Musk) versus polish before release (Jobs) — resolves at the phase boundary: iterate fast inside a phase, cross the gate polished. + +- **Step 0** (boscope): duty D — the stated request is a proxy; the experience is the requirement; the brief records the felt result. Focus is saying no — the exclusions slot gives the feature its shape. +- **Phase 2**: design is how it works — experience surfaces (defaults, empty states, error messages) join the design artifacts; a design that needs explaining gets simplified, not documented. +- **Phase 4**: the gate is the polish point — what crosses a gate is finished. +- `guidelines/workflow.md` carries the what/why sentences; `guidelines/review-checklist.md` gains the tenth check: experience seams treated as design. + +What stays out, deliberately: product secrecy, the reality-distortion field, and launch-event theater — persuasion and staging, not method; the same line ADR-005 drew between method and attitude. + +## Consequences + +- Step 0 now carries four duties; if briefs get heavy, D folds into B — they share the "design beyond the literal ask" move +- "Design beyond the literal ask, never against it" keeps duty D consistent with duty C: the user's WHAT stays physics; the HOW serves an experience +- Review now catches unworded errors and untouched defaults explicitly, instead of folding them into "complexity added" +- Re-audit with model generations per ADR-003: a model with reliable product taste may let the experience-surface checks shrink diff --git a/book/guidelines/README.md b/book/guidelines/README.md index e9578a8..ed697e5 100644 --- a/book/guidelines/README.md +++ b/book/guidelines/README.md @@ -11,7 +11,7 @@ The project's development rules. Every contributor — including AI agents — f | `workflow.md` | Six-phase gate workflow and the code↔book interaction rules | | `writing-style.md` | Plain-language standard for every book document | | `git-workflow.md` | Clean Commit format and Clean Flow branch/PR/merge rules | -| `review-checklist.md` | The nine code-review checks | +| `review-checklist.md` | The ten code-review checks | | `architecture.md` | Long-term architecture rules (template — replace per project) | | `coding-style.md` | Language-specific coding baseline (template — replace per project) | diff --git a/book/guidelines/review-checklist.md b/book/guidelines/review-checklist.md index 170a42a..201c349 100644 --- a/book/guidelines/review-checklist.md +++ b/book/guidelines/review-checklist.md @@ -1,5 +1,5 @@ --- -description: The nine code-review checks every change must pass — findings are recorded, never fixed in passing +description: The ten code-review checks every change must pass — findings are recorded, never fixed in passing --- # Code review checklist @@ -14,6 +14,7 @@ description: The nine code-review checks every change must pass — findings are - [ ] Missed boundaries (input ranges / empty values / extremes) - [ ] Complexity added - [ ] Parts that trace to no requirement (delete before optimize) +- [ ] Experience seams treated as design (defaults, empty states, error messages) - [ ] Changes outside the approved scope ## Principle diff --git a/book/guidelines/workflow.md b/book/guidelines/workflow.md index 00744cb..a92214c 100644 --- a/book/guidelines/workflow.md +++ b/book/guidelines/workflow.md @@ -18,11 +18,11 @@ Every feature moves through these phases in order. **No skipping.** | Phase 5 | Code review | Review findings | Record only — no fixes | | Phase 6 | Wrap-up | Docs, learnings, issues | Record only — no fixes | -Step 0 comes before any code. Fill the brief: background, scope (what it affects, what it explicitly does **not** affect, and the boundaries), and the requirement itself. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3 — the exclusions slot is required. Requirements arrive as suggestions; physics is the only law — correctness, data integrity, and the user's explicit hard constraints don't negotiate, while convention, past practice, and "how it's done" do. Question the inherited HOW; the user's WHAT holds (reasoning and sources in [ADR-005](../docs/decisions/ADR-005-distill-first-principles-into-design-phases.md)). +Step 0 comes before any code. Fill the brief: background, scope (what it affects, what it explicitly does **not** affect, and the boundaries), and the requirement itself. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3 — the exclusions slot is required. Requirements arrive as suggestions; physics is the only law — correctness, data integrity, and the user's explicit hard constraints don't negotiate, while convention, past practice, and "how it's done" do. Question the inherited HOW; the user's WHAT holds (reasoning and sources in [ADR-005](../docs/decisions/ADR-005-distill-first-principles-into-design-phases.md)). The stated request is a proxy — the experience behind it is the requirement: capture what the user will see, do, and get. Focus is saying no; the exclusions slot gives the feature its shape ([ADR-006](../docs/decisions/ADR-006-distill-experience-first-design-into-phases.md)). -Phase 2 produces the full design — data flow, file list, interfaces — and proceeds; it stops for the user only when a real gap appears (scope conflict, undetermined data shape, unclear external dependency), never just for confirmation. Designs and estimates derive bottom-up from primitives — what the data and code actually are — never by analogy to last time; delete what no requirement calls for before optimizing anything that remains. +Phase 2 produces the full design — data flow, file list, interfaces — and proceeds; it stops for the user only when a real gap appears (scope conflict, undetermined data shape, unclear external dependency), never just for confirmation. Designs and estimates derive bottom-up from primitives — what the data and code actually are — never by analogy to last time; delete what no requirement calls for before optimizing anything that remains. Design is how it works — the surfaces the user touches (defaults, empty states, error messages) are designed with the data flow, never decorated after it ([ADR-006](../docs/decisions/ADR-006-distill-experience-first-design-into-phases.md)). -Phase 4's hard part is the gate, not the sequence: all relevant tests green, no assertion weakened to get there, coverage of the normal path, boundary inputs (ranges, empty, extremes), error paths, and a regression check that existing behavior didn't break. Test-first (write a failing test → minimum implementation → refactor staying green) is the default loop — sequence the work however keeps the gate honest. +Phase 4's hard part is the gate, not the sequence: all relevant tests green, no assertion weakened to get there, coverage of the normal path, boundary inputs (ranges, empty, extremes), error paths, and a regression check that existing behavior didn't break. Test-first (write a failing test → minimum implementation → refactor staying green) is the default loop — sequence the work however keeps the gate honest. Iterate fast inside the phase; polish at the gate — what crosses a gate is finished: defaults chosen, errors worded, edges handled ([ADR-006](../docs/decisions/ADR-006-distill-experience-first-design-into-phases.md)). Phases 5 and 6 share one discipline: **record, never fix.** A problem found during review or wrap-up goes into `notes/issue/` — fixing it is a separate, later task. Fixing in passing feels efficient and destroys the gate: the review no longer reviews what was built. diff --git a/skills/boscope/SKILL.md b/skills/boscope/SKILL.md index d6b6218..1c20782 100644 --- a/skills/boscope/SKILL.md +++ b/skills/boscope/SKILL.md @@ -25,6 +25,8 @@ Render the brief below and fill every slot. For empty slots you have two duties: **C. Inherited → question.** Every requirement is a suggestion until it shows its law — physics is the law, everything else negotiates. Physics here: correctness, data integrity, the user's explicit hard constraints, real resource limits. Suggestions wearing physics clothes: "how it's done", industry habit, past practice, third-party defaults. The user's WHAT is physics; the HOW is suggestion — question what was inherited, never what was asked. +**D. Stated → experienced.** The stated request is a proxy; the experience behind it is the requirement — it's not the customer's job to know what they want. Record the felt result in the brief: what the user will see, do, and get when it works. Design beyond the literal ask; never against it. + ### Brief template ``` @@ -40,7 +42,7 @@ Render the brief below and fill every slot. For empty slots you have two duties: ``` -> The **exclusions** slot is REQUIRED. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3. +> The **exclusions** slot is REQUIRED. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3. Focus is saying no — the exclusions slot is where the feature gets its shape. **Axes checklist (review every time, raise the relevant ones):** permissions/auth · notifications · idempotency · cache invalidation · transaction boundaries · concurrency/races · rate limits · data migration · regression impact · generated-artifact sync (codegen / schema / proto — refresh per the project's build scripts after changes). @@ -56,12 +58,14 @@ Understand the requirement → find the relevant code → trace the call chain ### Phase 2: Design -**Output:** data flow, sequence diagram (optional), file change list, new interfaces, permission design, notification design, test points. +**Output:** data flow, sequence diagram (optional), file change list, new interfaces, permission design, notification design, experience surfaces (defaults, empty states, error messages), test points. **Derive, don't analogize.** Design and estimate bottom-up: decompose to primitives — what the data actually is, what the code actually does, measured costs — and reason up from there. An analogy ("the last similar feature took three days") is a data point, not an estimate. A gap between the bottom-up answer and the received number marks the real problem. **Delete before you optimize.** Question every part against its requirement: delete what nothing calls for, simplify what remains, and only then optimize or speed up. If nothing ever gets added back, you're deleting too little; optimizing a part that shouldn't exist is waste, faster. +**Design is how it works.** The surfaces the user touches — defaults, empty states, error messages — are the design itself, not decoration on the data flow. A design that needs explaining before it works gets simplified, not documented. + **Stop and wait for approval.** Do not enter Phase 3 until the user explicitly approves. (A kickoff message that clearly orders implementation and sets the technical context counts as approval — record that basis in the plan.) > **Permissions + notifications** are the two slots agents forget most. Even when the answer is "not needed this time", state it explicitly. @@ -74,7 +78,7 @@ Strictly per the approved design. **No changes outside scope, no refactors, no n ### Phase 4: Testing (test-first) -Write a failing test → write the minimal implementation that passes → refactor with tests green. This loop is the iteration engine — run it fast and let it fail: a red test is data, not a setback. Iterate freely inside the phase, never past the gate. +Write a failing test → write the minimal implementation that passes → refactor with tests green. This loop is the iteration engine — run it fast and let it fail: a red test is data, not a setback. Iterate freely inside the phase, never past the gate. What crosses the gate crosses it polished — defaults chosen, errors worded, edges handled. **Coverage (all required):** normal path · permission checks · boundaries (input ranges / empty / extremes) · error paths · regression (existing behavior intact). From 2c69cfba8ba3d711d7ce29b5ec759493344aff3c Mon Sep 17 00:00:00 2001 From: Focus Date: Thu, 5 Nov 2026 12:06:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20setup=20(tools):=20add?= =?UTF-8?q?=20changelog,=20upgrade=20playbook,=20and=20release=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/git-policy.yml | 10 ++++ ADOPT.md | 11 ++-- AGENTS.md | 5 ++ CHANGELOG.md | 28 ++++++++++ README.ja.md | 4 ++ README.md | 4 ++ README.zh-CN.md | 4 ++ UPGRADE.md | 42 +++++++++++++++ book/README.md | 3 +- ...ADR-007-template-updates-reach-adopters.md | 36 +++++++++++++ book/docs/decisions/README.md | 2 +- book/guidelines/git-workflow.md | 3 +- book/guidelines/workflow.md | 6 +-- scripts/check-release-changelog.mjs | 54 +++++++++++++++++++ scripts/init-project.sh | 14 +++-- skills/bocode/SKILL.md | 3 +- 16 files changed, 216 insertions(+), 13 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 UPGRADE.md create mode 100644 book/docs/decisions/ADR-007-template-updates-reach-adopters.md create mode 100644 scripts/check-release-changelog.mjs diff --git a/.github/workflows/git-policy.yml b/.github/workflows/git-policy.yml index fd49a1e..48ea3e0 100644 --- a/.github/workflows/git-policy.yml +++ b/.github/workflows/git-policy.yml @@ -56,6 +56,16 @@ jobs: else node scripts/check-commit-message.mjs "$PR_TITLE" fi + - name: Check release changelog + env: + BASE_REF: ${{ github.event.pull_request.base.ref }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + if [ "$BASE_REF" = "main" ]; then + node scripts/check-release-changelog.mjs origin/main "$HEAD_SHA" + else + echo "Not a release PR; changelog gate skipped." + fi - name: Check template cleanliness run: cd code && npm run book:release-check diff --git a/ADOPT.md b/ADOPT.md index 4ed0827..27d3434 100644 --- a/ADOPT.md +++ b/ADOPT.md @@ -4,7 +4,7 @@ ## What you are installing -BoCode gives a project two halves: `code/` (the source) and `book/` (the documentation stream and knowledge base), driving each other in both directions. You will install: the `book/` skeleton, the index tooling, the git policy tooling (optional), the four skills, and an `AGENTS.md` entry point. You will migrate the project's existing docs into the book. You will **not** refactor any code. +BoCode gives a project two halves: `code/` (the source) and `book/` (the documentation stream and knowledge base), driving each other in both directions. You will install: the `book/` skeleton, the index tooling, the git policy tooling (optional), the four skills, an `AGENTS.md` entry point, and a `.bocode-version` stamp so future upgrades know the baseline. You will migrate the project's existing docs into the book. You will **not** refactor any code. Before starting, read in the BoCode repository: `AGENTS.md`, `book/guidelines/workflow.md`, and `skills/README.md` — this playbook assumes you know the target shape. @@ -63,8 +63,9 @@ Adapt BoCode's `AGENTS.md`: fill the project overview (what it is, in two senten 1. Index generator: zero warnings, exit 0. 2. `git config core.hooksPath .githooks` (if adopted) and the hook fires on commit. -3. Commit the adoption. Follow the project's existing commit convention unless the user chooses to adopt Clean Commit — their call, not yours. -4. Don't rewrite git history. Adoption is ordinary commits on top of what exists. +3. Write `.bocode-version` at the project root — one line with the BoCode repository's current HEAD SHA (`git -C rev-parse HEAD`). Future upgrades diff against it. +4. Commit the adoption. Follow the project's existing commit convention unless the user chooses to adopt Clean Commit — their call, not yours. +5. Don't rewrite git history. Adoption is ordinary commits on top of what exists. ## Step 8 — First writeback @@ -72,6 +73,10 @@ Adapt BoCode's `AGENTS.md`: fill the project overview (what it is, in two senten 2. Write the project's own `ADR-001: adopt the BoCode workflow` in `book/docs/decisions/` — context from the inventory, the Option A/B decision and why, consequences. 3. Regenerate the index. Done. +## Later upgrades + +When the BoCode template evolves, hand `UPGRADE.md` from the BoCode repository to an agent — it diffs the project's `.bocode-version` stamp against template HEAD, refreshes template-owned files, and leaves the project's own records untouched. `CHANGELOG.md` lists every change since the stamp. + ## What not to do - No code refactoring, renaming, or "improvements" — structure only; behavior is out of scope diff --git a/AGENTS.md b/AGENTS.md index 5ab1002..79656c7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -31,6 +31,10 @@ Feature development strictly follows the six-phase gate workflow — see `book/g Git commits and branching strictly follow `book/guidelines/git-workflow.md`: every non-merge commit uses the Clean Commit format; independent big features branch from `dev`; small verified fixes may commit to `dev` directly; PRs serve multi-contributor work and the `dev → main` release, which only ever merges. Never commit or push directly to `main`. +## Staying current + +This workflow's template evolves. To sync an installed project, an agent reads `UPGRADE.md` and `CHANGELOG.md` from the BoCode repository (https://github.com/Focus695/BoCode) — the project's `.bocode-version` stamp records what it last synced to. + ## Document routing | Output | Location | Audience | @@ -74,3 +78,4 @@ Local commands are disposable and have no production access — npm scripts, tes - `cd code && npm run book:index` — regenerate `book/README.md` after any book change (do not edit by hand; missing frontmatter `description` warns and exits 1) - `cd code && npm run book:release-check` — verify the tree holds no instance working records; must be green before the `dev → main` release PR - `node scripts/check-commit-message.mjs ""` — validate a commit subject against Clean Commit +- `node scripts/check-release-changelog.mjs ` — release gate: a dev→main range that touches template-owned content must also update `CHANGELOG.md` (ADR-007) diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2287411 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +Releases of the BoCode template itself. Adopting projects upgrade by handing [UPGRADE.md](UPGRADE.md) to an agent; each entry lists what changed and what an adopting project must do. History before 2026-11-05 lives in git log and [book/docs/decisions/](book/docs/decisions/) (ADR-001..ADR-004). + +## 2026-11-05 — template updates reach adopters (ADR-007) + +The upgrade mechanism itself, plus a link-integrity fix. + +- Added: `CHANGELOG.md` (this file), `UPGRADE.md` (the agent-facing upgrade playbook), `scripts/check-release-changelog.mjs` (release gate, wired into `.github/workflows/git-policy.yml`), `.bocode-version` stamping (written at adoption by `ADOPT.md` / `scripts/init-project.sh`) +- Changed: `book/guidelines/workflow.md` — the four ADR-005/006 references are plain text now (as links they broke the index build in projects that copy `guidelines/` only); `book/docs/decisions/README.md` — its ADR-001 link got the same fix; `AGENTS.md` (a Staying-current section + a fourth tooling command); `book/guidelines/git-workflow.md` (release prerequisite); `ADOPT.md` and `scripts/init-project.sh` (version stamp + upgrade pointers); `README.md` / `README.zh-CN.md` / `README.ja.md` (FAQ entry); `skills/bocode/SKILL.md` (upgrade contract) + +**Adopter action:** nothing to copy. Projects adopted before this entry have no `.bocode-version` — run UPGRADE.md once to stamp the baseline (its no-stamp fallback path), then stay on the normal procedure. + +## 2026-11-05 — experience-first design (ADR-006) + +Steve Jobs's product philosophy distilled into the design phases: the request is a proxy for an experience, design is how it works, focus is saying no, and the gate is the polish point. + +- Changed: `skills/boscope/SKILL.md` (Step-0 duty D "Stated → experienced"; the exclusions note gains "focus is saying no"; Phase-2 output adds experience surfaces and a "Design is how it works" paragraph; Phase-4 gains the polish line); `book/guidelines/workflow.md` (three what/why sentences); `book/guidelines/review-checklist.md` (ninth → tenth check: experience seams treated as design); `book/guidelines/README.md` (row wording) + +**Adopter action:** copy the four changed files (merge `review-checklist.md` if you customized it); sync translated variants of boscope (e.g. structured-feature-implementation) with the same four insertions. + +## 2026-11-05 — first principles in the design phases (ADR-005) + +Elon Musk's engineering method distilled into the design phases: requirements face a physics test, estimates derive bottom-up, deletion precedes optimization. + +- Changed: `skills/boscope/SKILL.md` (Step-0 duty C "Inherited → question"; Phase-2 "Derive, don't analogize" and "Delete before you optimize"; Phase-4 iteration line); `book/guidelines/workflow.md` (Step-0 and Phase-2 sentences); `book/guidelines/review-checklist.md` (eighth → ninth check: parts that trace to no requirement); `book/guidelines/README.md` (row wording) + +**Adopter action:** copy the four changed files (merge `review-checklist.md` if you customized it); sync translated variants of boscope with the same three insertions. diff --git a/README.ja.md b/README.ja.md index 78ec622..46c4988 100644 --- a/README.ja.md +++ b/README.ja.md @@ -187,12 +187,16 @@ cp -r skills/bocode skills/boscope skills/book-writeback skills/bowrite **This file is for AI agents.** A project adopted the BoCode workflow at some point in the past; the template has moved on. Your job: bring the installed copy up to date without touching the project's own content. Follow it top to bottom. + +The BoCode repository: https://github.com/Focus695/BoCode — its `CHANGELOG.md` tells you what changed; this file tells you how to apply it. + +## What is template-owned vs project-owned + +The one table that decides everything. Template-owned files get refreshed; project-owned files are never touched. + +| Template-owned (refresh) | Project-owned (never touch) | +|--------------------------|------------------------------| +| `book/guidelines/{README,workflow,writing-style,git-workflow,review-checklist}.md` | `AGENTS.md`, root `README.md` | +| the `README.md` of every `book/` directory (`docs/`, `docs/decisions/`, `docs/architecture/`, `docs/api/`, `notes/`, `plans/`, `changelogs/`) | `book/guidelines/architecture.md` and `coding-style.md` (project drafts since adoption) | +| `skills/` — all four skills plus `skills/README.md` | everything under `book/docs/decisions/`, `book/docs/architecture/`, `book/docs/api/` (the project's own records) | +| `code/tools/*.mjs`; the `scripts` block of `code/package.json` (keep the project's `name`) | everything under `book/notes/`, `book/plans/`, `book/changelogs/` | +| `scripts/check-*.mjs` (if adopted), `.githooks/` (if adopted), `.github/workflows/git-policy.yml` (if adopted — keep the template-clean step deleted, per ADOPT.md) | `book/README.md` (generated — regenerate, don't copy), `.bocode-version` | + +## The procedure + +1. Read `.bocode-version` at the project root: it holds the BoCode commit the project last synced to. No stamp (adopted before 2026-11-05)? Use the fallback below. +2. Clone the BoCode repository in full — not `--depth 1`, the stamp's commit must be reachable: `git clone https://github.com/Focus695/BoCode /tmp/bocode`. +3. List what changed: `git -C /tmp/bocode diff --name-status ..HEAD`, keep the rows that match the template-owned column, and read the `CHANGELOG.md` entries after the stamp for the intent and each entry's **Adopter action**. +4. Apply, per file: + - project copy unmodified since adoption (matches the stamp's template version) → copy the new version over it + - project copy modified → merge by hand: take the template's changes, keep the project's edits, ask the user where they collide + - project-owned path → never touch +5. Sync translated variants of the skills (e.g. a localized boscope) with the same insertions, if the project keeps any. +6. Regenerate and verify: `cd code && npm run book:index` must end with zero warnings and all links resolving. +7. Update `.bocode-version` to the new HEAD SHA (`git -C /tmp/bocode rev-parse HEAD`). + +ADR numbers referenced in the guidelines (e.g. "ADR-006") are the template's own records — read them in the BoCode repository's `book/docs/decisions/`. + +## Fallback: no stamp + +Projects adopted before the stamp existed have no baseline. Walk `CHANGELOG.md` top to bottom instead: every entry's **Adopter action** names the files it touched — compare each against the project's copy; identical or trivially old → apply per the rules above; project-modified → merge; conflicts → ask the user. Then stamp the current HEAD SHA and continue on the normal procedure. + +## What not to do + +- Never overwrite a project-owned file — records, drafts, and ADRs belong to the project +- Never re-add the "Check template cleanliness" step to a copied `git-policy.yml` (that gate is the template repo's own, per ADOPT.md) +- Don't invent version numbers: the stamp is a commit SHA, and that is the whole versioning story (ADR-007) diff --git a/book/README.md b/book/README.md index 87bce1b..d155c0c 100644 --- a/book/README.md +++ b/book/README.md @@ -54,6 +54,7 @@ description: Master index of the book — the map of every document. Regenerate - [ADR-004-template-free-of-instance-records.md](docs/decisions/ADR-004-template-free-of-instance-records.md) — This repository ships template content only — instance working records (notes entries, plans, changelog months) never enter it; a release check enforces the boundary - [ADR-005-distill-first-principles-into-design-phases.md](docs/decisions/ADR-005-distill-first-principles-into-design-phases.md) — Musk's first-principles engineering method is woven into the design phases — requirements face a physics test, estimates derive bottom-up, deletion precedes optimization - [ADR-006-distill-experience-first-design-into-phases.md](docs/decisions/ADR-006-distill-experience-first-design-into-phases.md) — Jobs's experience-first craft is woven in beside ADR-005 — the request is a proxy for an experience, design is how it works, focus is saying no, and gates are the polish point +- [ADR-007-template-updates-reach-adopters.md](docs/decisions/ADR-007-template-updates-reach-adopters.md) — Template updates reach adopters through a root CHANGELOG, an agent-facing UPGRADE playbook, and a .bocode-version stamp — release-gated by CI; semver rejected, the commit SHA is the baseline - [README.md](docs/decisions/README.md) — How to write an ADR here — sections, naming, numbering, and when a decision needs a record ### guidelines/ @@ -74,4 +75,4 @@ description: Master index of the book — the map of every document. Regenerate - [README.md](plans/README.md) — Plans directory usage — implementation plans land here after Phase 2 approval, with naming and the plan template - + diff --git a/book/docs/decisions/ADR-007-template-updates-reach-adopters.md b/book/docs/decisions/ADR-007-template-updates-reach-adopters.md new file mode 100644 index 0000000..c8f6999 --- /dev/null +++ b/book/docs/decisions/ADR-007-template-updates-reach-adopters.md @@ -0,0 +1,36 @@ +--- +description: Template updates reach adopters through a root CHANGELOG, an agent-facing UPGRADE playbook, and a .bocode-version stamp — release-gated by CI; semver rejected, the commit SHA is the baseline +--- + +# ADR-007: Template updates reach adopters + +## Status + +Accepted — 2026-11-05. Enforced on dev→main PRs by `scripts/check-release-changelog.mjs`, wired into `.github/workflows/git-policy.yml`. + +## Context + +The template evolves (ADR-005 and ADR-006 landed within two days); adopting projects stay at the version they installed, and nothing told them otherwise — ADOPT.md covers first adoption only, the READMEs never mention upgrading, and no version concept exists anywhere in the tree (`code/package.json`'s `version` is a dead field nothing reads). ADR-004's consequences reserved this exact case: "a changelog of template changes, say, gets decided case by case." + +Two constraints shaped the design. Adopters install by copying (clone-and-transform via init-project.sh, or retrofit via ADOPT.md), so update delivery is documentation an agent can follow, not a package manager. And the project's own records must be untouchable — the upgrade path has to know which files the template still owns after adoption. + +## Decision + +Four pieces, all shipping in the template: + +- **`CHANGELOG.md` at the root** — the template's own release log: dated entries, each listing changed files and an explicit **Adopter action**. This rules ADR-004's reserved case: it is template content distributed with the repository (init-project.sh deletes it on transform), not an instance record — `book/changelogs/` stays for adopting projects only. +- **`UPGRADE.md` at the root** — the agent-facing upgrade playbook: read `.bocode-version`, diff the stamp against template HEAD, refresh untouched files, merge modified ones, never touch project-owned ones, regenerate the index, re-stamp. Its template-owned vs project-owned table is the contract; new template files must be added there. +- **`.bocode-version`** — a one-line stamp in the adopting project's root holding the BoCode commit it last synced to; written at adoption (ADOPT.md, init-project.sh), updated on every upgrade. Commit SHAs, not version numbers: the template evolves as a document stream, so semver levels carry no meaning here, and `package.json`'s version stays a dead field (no bumps, no tags, no GitHub Releases for now). +- **A release gate** — `scripts/check-release-changelog.mjs` fails a dev→main PR whose diff touches template-owned content without also touching `CHANGELOG.md`. A rule that can be checked against a diff is a gate; one that can't is a wish. + +Entry points so an agent in any installed project finds its way back: a Staying-current section in AGENTS.md (survives both installation paths), an upgrade contract in the `bocode` skill, and a FAQ item in all three READMEs. + +Also fixed here: real links to template ADRs inside copyable files — `guidelines/workflow.md` (ADR-005/006) and `docs/decisions/README.md` (ADR-001) — broke the index build in projects that copy only the ADOPT.md manifest. Template ADR references are plain text now, the ADR-003 precedent. + +## Consequences + +- Adopters upgrade by handing UPGRADE.md to an agent, the same way they adopted by handing over ADOPT.md +- Every release that changes template content now carries a changelog obligation, enforced in CI +- The ownership table doubles as a checklist when adding template files — forget it and adopters' upgrades silently skip the new file +- Projects that edited template-owned files get merges, never silent overwrites; conflicts surface to their user +- The stamp depends on the BoCode repository's git history being reachable (a full clone); the CHANGELOG-driven fallback covers stamp-less projects diff --git a/book/docs/decisions/README.md b/book/docs/decisions/README.md index e2dc5cc..f70e550 100644 --- a/book/docs/decisions/README.md +++ b/book/docs/decisions/README.md @@ -25,4 +25,4 @@ An architecture decision record answers the question future readers — humans a `ADR-NNN-.md`, numbering monotonically up, never reused. A decision that reverses an earlier ADR gets a new number and flips the old one to "Superseded by ADR-NNN". -See [ADR-001](ADR-001-adopt-bocode.md) for a worked example. +ADR-001 in the BoCode repository is a worked example. diff --git a/book/guidelines/git-workflow.md b/book/guidelines/git-workflow.md index 714f9ad..4597484 100644 --- a/book/guidelines/git-workflow.md +++ b/book/guidelines/git-workflow.md @@ -114,7 +114,7 @@ git push origin dev When several people build the same feature, open the PR from `feature/user-profile` into `dev` and **Squash and merge** after checks; the squash subject uses Clean Commit too. Delete the work branch after merging. -When `dev` is stable, run `cd code && npm run book:release-check` first — the release ships template content only, and instance working records (note entries, plans, changelog months) fail the check (ADR-004). Then open the `dev → main` PR and choose **Create a merge commit** to preserve the integration boundary. The merge-commit subject is Clean Commit as well, e.g.: +When `dev` is stable, run `cd code && npm run book:release-check` first — the release ships template content only, and instance working records (note entries, plans, changelog months) fail the check (ADR-004). Also update the root `CHANGELOG.md` with this release's template changes — the release PR fails CI without it when template-owned content changed (ADR-007). Then open the `dev → main` PR and choose **Create a merge commit** to preserve the integration boundary. The merge-commit subject is Clean Commit as well, e.g.: ```text 🚀 release: promote dev to main @@ -124,6 +124,7 @@ When `dev` is stable, run `cd code && npm run book:release-check` first — the - PRs into `dev`/`main` and pushes to them are checked by `.github/workflows/git-policy.yml` for branch direction and commit subjects; direct pushes to `dev` still pass Clean Commit validation. - The same workflow runs `book:release-check` on every PR and push to `dev`/`main`; it fails the moment an instance working record enters the tree (ADR-004). +- Release PRs into `main` also run `scripts/check-release-changelog.mjs`: template-owned changes must ship with a `CHANGELOG.md` entry (ADR-007). - Run `git config core.hooksPath .githooks` once per clone to get the same `commit-msg` check locally. - Protect `main` on GitHub: require a PR from `dev`, status checks, and merge commits. Keep direct pushes to `dev` allowed for solo speed; team PRs still use squash merges. diff --git a/book/guidelines/workflow.md b/book/guidelines/workflow.md index a92214c..6bde44d 100644 --- a/book/guidelines/workflow.md +++ b/book/guidelines/workflow.md @@ -18,11 +18,11 @@ Every feature moves through these phases in order. **No skipping.** | Phase 5 | Code review | Review findings | Record only — no fixes | | Phase 6 | Wrap-up | Docs, learnings, issues | Record only — no fixes | -Step 0 comes before any code. Fill the brief: background, scope (what it affects, what it explicitly does **not** affect, and the boundaries), and the requirement itself. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3 — the exclusions slot is required. Requirements arrive as suggestions; physics is the only law — correctness, data integrity, and the user's explicit hard constraints don't negotiate, while convention, past practice, and "how it's done" do. Question the inherited HOW; the user's WHAT holds (reasoning and sources in [ADR-005](../docs/decisions/ADR-005-distill-first-principles-into-design-phases.md)). The stated request is a proxy — the experience behind it is the requirement: capture what the user will see, do, and get. Focus is saying no; the exclusions slot gives the feature its shape ([ADR-006](../docs/decisions/ADR-006-distill-experience-first-design-into-phases.md)). +Step 0 comes before any code. Fill the brief: background, scope (what it affects, what it explicitly does **not** affect, and the boundaries), and the requirement itself. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3 — the exclusions slot is required. Requirements arrive as suggestions; physics is the only law — correctness, data integrity, and the user's explicit hard constraints don't negotiate, while convention, past practice, and "how it's done" do. Question the inherited HOW; the user's WHAT holds (reasoning and sources in ADR-005, in the BoCode repository's `book/docs/decisions/`). The stated request is a proxy — the experience behind it is the requirement: capture what the user will see, do, and get. Focus is saying no; the exclusions slot gives the feature its shape (ADR-006). -Phase 2 produces the full design — data flow, file list, interfaces — and proceeds; it stops for the user only when a real gap appears (scope conflict, undetermined data shape, unclear external dependency), never just for confirmation. Designs and estimates derive bottom-up from primitives — what the data and code actually are — never by analogy to last time; delete what no requirement calls for before optimizing anything that remains. Design is how it works — the surfaces the user touches (defaults, empty states, error messages) are designed with the data flow, never decorated after it ([ADR-006](../docs/decisions/ADR-006-distill-experience-first-design-into-phases.md)). +Phase 2 produces the full design — data flow, file list, interfaces — and proceeds; it stops for the user only when a real gap appears (scope conflict, undetermined data shape, unclear external dependency), never just for confirmation. Designs and estimates derive bottom-up from primitives — what the data and code actually are — never by analogy to last time; delete what no requirement calls for before optimizing anything that remains. Design is how it works — the surfaces the user touches (defaults, empty states, error messages) are designed with the data flow, never decorated after it (ADR-006). -Phase 4's hard part is the gate, not the sequence: all relevant tests green, no assertion weakened to get there, coverage of the normal path, boundary inputs (ranges, empty, extremes), error paths, and a regression check that existing behavior didn't break. Test-first (write a failing test → minimum implementation → refactor staying green) is the default loop — sequence the work however keeps the gate honest. Iterate fast inside the phase; polish at the gate — what crosses a gate is finished: defaults chosen, errors worded, edges handled ([ADR-006](../docs/decisions/ADR-006-distill-experience-first-design-into-phases.md)). +Phase 4's hard part is the gate, not the sequence: all relevant tests green, no assertion weakened to get there, coverage of the normal path, boundary inputs (ranges, empty, extremes), error paths, and a regression check that existing behavior didn't break. Test-first (write a failing test → minimum implementation → refactor staying green) is the default loop — sequence the work however keeps the gate honest. Iterate fast inside the phase; polish at the gate — what crosses a gate is finished: defaults chosen, errors worded, edges handled (ADR-006). Phases 5 and 6 share one discipline: **record, never fix.** A problem found during review or wrap-up goes into `notes/issue/` — fixing it is a separate, later task. Fixing in passing feels efficient and destroys the gate: the review no longer reviews what was built. diff --git a/scripts/check-release-changelog.mjs b/scripts/check-release-changelog.mjs new file mode 100644 index 0000000..dfb4bab --- /dev/null +++ b/scripts/check-release-changelog.mjs @@ -0,0 +1,54 @@ +#!/usr/bin/env node +// check-release-changelog.mjs — release gate for CHANGELOG.md (ADR-007). +// +// node scripts/check-release-changelog.mjs +// +// Fails when the base...head diff touches template-owned content but +// CHANGELOG.md is not part of the diff. Template-owned = what adopting +// projects install (guidelines, skills, tooling, agent entry points). +// The list mirrors the ownership table in UPGRADE.md — keep them in sync. + +import { execSync } from "node:child_process"; + +const TEMPLATE_PREFIXES = [ + "AGENTS.md", + "ADOPT.md", + "UPGRADE.md", + "book/guidelines/", + "book/docs/decisions/", + "skills/", + "code/tools/", + "code/package.json", + "scripts/", + ".githooks/", + ".github/workflows/", +]; + +const CHANGELOG = "CHANGELOG.md"; + +const [base, head] = process.argv.slice(2); +if (!base || !head) { + console.error("Usage: node scripts/check-release-changelog.mjs "); + process.exit(1); +} + +const diff = execSync(`git diff --name-only ${base}...${head}`, { encoding: "utf8" }); +const changed = diff.split("\n").filter(Boolean); +const templateChanges = changed.filter((f) => + TEMPLATE_PREFIXES.some((p) => f === p || f.startsWith(p)), +); + +if (templateChanges.length === 0) { + console.log("No template-owned changes in range; CHANGELOG.md not required."); + process.exit(0); +} + +if (changed.includes(CHANGELOG)) { + console.log(`CHANGELOG.md updated alongside ${templateChanges.length} template-owned change(s). Gate passed.`); + process.exit(0); +} + +console.error("Release gate failed (ADR-007): template-owned content changed without a CHANGELOG.md update:"); +for (const f of templateChanges) console.error(` ${f}`); +console.error("Adopters learn about template changes only through CHANGELOG.md — add an entry and rerun."); +process.exit(1); diff --git a/scripts/init-project.sh b/scripts/init-project.sh index 7edb486..c9dba73 100755 --- a/scripts/init-project.sh +++ b/scripts/init-project.sh @@ -12,7 +12,8 @@ # 4. Clears any dated living records (defensive: the template ships clean; # this covers clones that carry records, e.g. from the BoCode origin) # 5. Regenerates the book index -# 6. Optionally resets git history for a clean start +# 6. Stamps .bocode-version with the BoCode commit (upgrades diff against it) +# 7. Optionally resets git history for a clean start # # Requires: bash, node (any version from the last few years). @@ -77,7 +78,7 @@ ${DESC} This project runs on the BoCode workflow. EOF -rm -f README.zh-CN.md README.ja.md ADOPT.md +rm -f README.zh-CN.md README.ja.md ADOPT.md CHANGELOG.md UPGRADE.md # 4. Clear BoCode's own living records for kind in learn summary issue; do @@ -98,7 +99,12 @@ fi # 5. Regenerate the book index (cd code && node tools/gen-book-index.mjs) -# 6. Optional: fresh git history +# 6. Stamp the BoCode version (upgrades diff against it — see UPGRADE.md upstream) +if git rev-parse --git-dir >/dev/null 2>&1; then + git rev-parse HEAD > .bocode-version +fi + +# 7. Optional: fresh git history if [ -t 0 ]; then printf "Reset git history and start fresh? [y/N] " read -r RESET @@ -120,3 +126,5 @@ echo " 2. Point your AI agent at AGENTS.md (most tools pick it up automatically echo " 3. Fill in book/guidelines/architecture.md and coding-style.md for your project." echo " 4. Set your remote:" echo " git remote add origin " +echo " 5. To upgrade later: an agent reads UPGRADE.md + CHANGELOG.md at" +echo " https://github.com/Focus695/BoCode (your .bocode-version pins the baseline)." diff --git a/skills/bocode/SKILL.md b/skills/bocode/SKILL.md index 7f80f66..9dca376 100644 --- a/skills/bocode/SKILL.md +++ b/skills/bocode/SKILL.md @@ -34,10 +34,11 @@ book/ **Finishing work:** sync the book — plan status, summary, new issues, changelog entry — then regenerate the index. Details of what to write where are in the **book-writeback** skill. -## The two contracts +## The contracts 1. **Index contract**: every new book document starts with frontmatter `description` — one plain-language line about the *content* (not the genre). After any book change, run `cd code && npm run book:index`; the build fails on a missing description, and that's the point. 2. **Record-only contract**: problems found during review or wrap-up are recorded to `notes/issue/`, never fixed in passing. A recorded problem becomes a task; fixing is separate work. +3. **Upgrade contract**: the template evolves — when the user asks to sync BoCode or the workflow feels stale, read `UPGRADE.md` and `CHANGELOG.md` from the BoCode repository (https://github.com/Focus695/BoCode); the project's `.bocode-version` stamp is the baseline to diff against. ## What not to do