Skip to content
Merged
21 changes: 12 additions & 9 deletions ADOPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ Every migrated file gets a frontmatter `description` β€” one plain-language line

## Step 4 β€” Install the tooling

1. Copy `code/tools/gen-book-index.mjs` and wire the script (see the `scripts` block in BoCode's `code/package.json`). If the project has no JavaScript tooling at all, a shell wrapper calling `node` is fine β€” the script is zero-dependency.
2. Optional, recommended: copy `scripts/check-commit-message.mjs` and `.githooks/`, then run `git config core.hooksPath .githooks`.
3. Optional: copy `.github/workflows/git-policy.yml`. **Check the branch names** β€” if the project's integration branch isn't `dev`, either ask the user to adopt the branch model or adapt the workflow's branch filters. Don't silently rewrite their branch model. Also **delete the "Check template cleanliness" step** β€” it enforces the BoCode template repository's own cleanliness rule (its ADR-004) and would fail on a real project's notes and changelogs.
4. Run the index generator: every book file must carry a `description` and every internal link must resolve; zero warnings is the only passing state.
1. Copy all of `code/tools/` (the index generator plus the `bocode-upgrade` / `bocode-doctor` sync gate and its selftest) and wire the `scripts` block from BoCode's `code/package.json` into the project's `code/package.json` (keep the project's `name`). If the project has no JavaScript tooling at all, a shell wrapper calling `node` is fine β€” the scripts are zero-dependency.
2. Copy `UPGRADE.md` to the project root β€” it is the upgrade playbook, template-owned, and refreshes itself on every future sync.
3. Optional, recommended: copy `scripts/check-commit-message.mjs` and `.githooks/`, then run `git config core.hooksPath .githooks`.
4. Optional: copy `.github/workflows/git-policy.yml`. **Check the branch names** β€” if the project's integration branch isn't `dev`, either ask the user to adopt the branch model or adapt the workflow's branch filters. Don't silently rewrite their branch model. Also **delete the "Check template cleanliness" step** β€” it enforces the BoCode template repository's own cleanliness rule (its ADR-004) and would fail on a real project's notes and changelogs.
5. Run the index generator: every book file must carry a `description` and every internal link must resolve; zero warnings is the only passing state.

## Step 5 β€” Install the skills

Copy `skills/bocode`, `skills/boscope`, `skills/book-writeback`, and `skills/bowrite` into the agent's skills directory (see BoCode's `skills/README.md` for per-tool locations). If the user's agent can't install skills, the workflow still works β€” the guidelines carry the same rules in prose.
Copy `skills/bocode`, `skills/boscope`, `skills/book-writeback`, and `skills/bowrite` into the agent's skills directory (see BoCode's `skills/README.md` for per-tool locations). If the user's agent can't install skills, the workflow still works β€” the guidelines carry the same rules in prose. Skills do not auto-update: every later BoCode sync must re-install them (`cd code && npm run bocode:upgrade -- --apply --skills-dir <dir>`), or the agent keeps running the old behavior.

## Step 6 β€” Write the project's `AGENTS.md`

Expand All @@ -63,9 +64,11 @@ 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. Write `.bocode-version` at the project root β€” one line with the BoCode repository's current HEAD SHA (`git -C <bocode-clone> 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.
3. `cd code && npm run bocode:selftest` β€” the sync gate proves itself on a fixture; green is the only passing state.
4. Write `.bocode-version` at the project root β€” one line with the BoCode repository's current HEAD SHA (`git -C <bocode-clone> rev-parse HEAD`). Future upgrades diff against it.
5. `npm run bocode:doctor` β€” clean, or knowingly green on the warnings.
6. Commit the adoption. Follow the project's existing commit convention unless the user chooses to adopt Clean Commit β€” their call, not yours.
7. Don't rewrite git history. Adoption is ordinary commits on top of what exists.

## Step 8 β€” First writeback

Expand All @@ -75,7 +78,7 @@ Adapt BoCode's `AGENTS.md`: fill the project overview (what it is, in two senten

## 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.
The sync tooling installed in Step 4 carries the project forward: `cd code && npm run bocode:doctor` reports staleness, `npm run bocode:upgrade -- --check` lists every template-owned delta, and `--apply` refreshes pristine files, merges script entries, re-installs the skills (with `--skills-dir`), verifies, and writes a report into the project's `book/changelogs/`. `UPGRADE.md` at the project root is the playbook β€” a sync is done when `--verify` exits 0.

## What not to do

Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Git commits and branching strictly follow `book/guidelines/git-workflow.md`: eve

## 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.
This workflow's template evolves, and the sync tooling ships with the project (template-owned, refreshes itself on every sync): `cd code && npm run bocode:doctor` reports staleness against the BoCode repository (https://github.com/Focus695/BoCode), and `npm run bocode:upgrade -- --check` lists every template-owned delta since the `.bocode-version` stamp. `UPGRADE.md` at the root is the playbook. **A sync is done when `--verify` exits 0 β€” never when an agent says so** β€” and the agent-side skills must be re-installed with it (`--skills-dir`). Sessions open with a doctor check; an optional `.bocode.json` at the root tunes automation β€” `autoSync: "ask"` (default) offers the sync, `"auto"` lets the agent run the conflict-free subset via `--apply --ff-only`, and `skillsDir` / `skillsTool` declare where skills install.

## Document routing

Expand Down
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
# 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).
Releases of the BoCode template itself. Adopting projects upgrade with the sync tooling that ships with them β€” `cd code && npm run bocode:upgrade` per [UPGRADE.md](UPGRADE.md); 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).

When adding an entry, also refresh the collapsed What's-new block near the top of the three READMEs (`README.md`, `README.zh-CN.md`, `README.ja.md`): newest title in the summary line, latest three titles as bullets.

## 2026-11-15 β€” scenario acceptance criteria and plan behavior deltas (ADR-014)

Distilled from [OpenSpec](https://github.com/Fission-AI/OpenSpec) (Fission-AI, MIT): acceptance criteria in the Step-0 brief are now written as one-line GIVEN/WHEN/THEN scenarios β€” observable outcomes, normal and error paths β€” and Phase 4's coverage starts by running down that list; L-tier plans state acceptance as a behavior delta (ADDED/MODIFIED/REMOVED relative to today), so review sees what changes in behavior, not only what gets built. A deep-verification pass over OpenSpec's verify discipline added one more rule: deliberately removed behavior is checked for absence β€” gone, not merely unbroken. A real OpenSpec change drafted inside a BoCode-adopting project added the last piece: delta rows carry short stable IDs, at done every row cites its test or observation evidence (the plan records intent, it is not evidence), and user-confirmed requirements stay distinguishable from design-derived ones. The convergences (tiered rigor, behavior-first boundary, brownfield-first) are recorded in the ADR as validation of decisions the baseline had already made; the living-specs layer, mandatory proposal approval, and OpenSpec's tooling are deliberately not copied, with reasons in the ADR (the living-specs call is structural, not yet tested β€” its source change is unimplemented, and the question becomes observable only after it is archived).

- Added: `book/docs/decisions/ADR-014-distill-openspec-scenarios-and-deltas.md`
- Changed: `book/guidelines/workflow.md` (Step-0 scenario sentence; Phase-4 coverage starts with the brief's scenarios, regression includes removed-behavior absence), `book/plans/README.md` (acceptance scenarios in the brief slot; L-tier behavior-delta sentence with the REMOVED absence check, stable row IDs, done-time evidence links, user-confirmed vs design-derived distinction), `skills/boscope/SKILL.md` (brief template and Phase-4 coverage wording), `README.md` / `README.zh-CN.md` / `README.ja.md` (What's-new)

**Adopter action:** run your usual sync (`bocode:upgrade -- --apply`, then `--verify`). If you keep a session-side copy of the structured-feature-implementation skill, add the scenario line to its brief template yourself β€” session skills are yours, not template-owned.

## 2026-11-07 β€” session-start sync check, consent-gated auto-sync (ADR-013)

Staleness detection was still a manual step. The `bocode` skill now opens every session with `bocode:doctor -- --strict`; an optional project-owned `.bocode.json` tunes automation β€” `skillsDir` / `skillsTool` declare where skills install (no more per-run flags), and `autoSync` sets who pulls the trigger: `ask` (default) offers the sync, `auto` lets the agent run the conflict-free subset itself. The new `--apply --ff-only` gate refuses **before touching anything** when any file needs a human decision (`merged` / `diverged-delete` / `missing`), so automation can never land half a sync; syncs never interrupt a task in progress.

- Added: `book/docs/decisions/ADR-013-consent-gated-auto-sync.md`
- Changed: `code/tools/bocode-upgrade.mjs` (`--ff-only`; `.bocode.json` reading β€” skillsDir/skillsTool/autoSync, flag beats config, unknown values warn and degrade), `code/tools/bocode-doctor.mjs` (config wiring; behind-message names the autoSync policy), `code/tools/bocode-upgrade.test.mjs` (ff-only refusal leaves the tree untouched; ff-only pristine sync; config-driven skills re-install; malformed config degrades β€” 50 assertions), `skills/bocode/SKILL.md` (session-start step 0 + consent policy in the upgrade contract), `AGENTS.md` (Staying current gains the automation sentence), `UPGRADE.md` (`--ff-only` flag + Automation section), `README.md` / `README.zh-CN.md` / `README.ja.md` (FAQ sentence, What's-new)

**Adopter action:** run your next sync as usual (`bocode:upgrade` picks all of this up itself β€” the tool upgrades the tool). Optionally create `.bocode.json` at your root (`{"skillsTool": "zcode", "autoSync": "ask"}` β€” or `"auto"` to let session agents run conflict-free syncs unattended) and re-copy the four skills so the session-start check text lands. Human-decision conflicts keep going to you either way; nothing about ADR-012's verify gate changes.

## 2026-11-07 β€” upgrades become a tool-gated sync (ADR-012)

The upgrade path was prose an agent could skim and overclaim (an adopter's agent declared ADR-011 "incorporated" while its new reference file was missing); the playbook was deleted on install; the agent-side skills never re-installed; the stamp was compared against nothing. Syncing is now tool-gated: `bocode-upgrade` diffs the stamp mechanically, `--verify` exits 0 only when every template-owned delta is applied, merged, or consciously kept, `bocode:doctor` reports staleness, and a single `MANIFEST` owns template-vs-project paths for both the sync and the release gate.

- Added: `code/tools/bocode-upgrade.mjs` (check/apply/verify, the MANIFEST single source, `--skills-dir` skill re-install with a stray-target refusal guard, readable errors on a malformed local `package.json`, sync report into the adopter's `book/changelogs/`), `code/tools/bocode-doctor.mjs` (staleness checkup), `code/tools/bocode-upgrade.test.mjs` (no-network selftest), `book/docs/decisions/ADR-012-upgrade-sync-becomes-a-tool-gate.md`
- Changed: `code/package.json` (`bocode:upgrade` / `bocode:doctor` / `bocode:selftest` scripts), `UPGRADE.md` (rewritten around the tool; now template-owned and self-refreshing), `ADOPT.md` (installs all of `code/tools/` + `UPGRADE.md`, skills re-install obligation, doctor + selftest in verification), `scripts/init-project.sh` (keeps `UPGRADE.md`; next-steps point at the local tooling), `scripts/check-release-changelog.mjs` (imports `MANIFEST.releaseSignal`; the signal now also covers the three READMEs), `AGENTS.md` (Staying current β†’ local tooling, "done means `--verify` exits 0"), `skills/bocode/SKILL.md` (upgrade contract rewritten), `skills/README.md` (re-install on every upgrade), `README.md` / `README.zh-CN.md` / `README.ja.md` (FAQ, tour, What's-new)

**Adopter action:** bootstrap once β€” copy `code/tools/bocode-upgrade.mjs`, `bocode-doctor.mjs`, and `bocode-upgrade.test.mjs` from the BoCode repository into your `code/tools/`, add the three `bocode:*` entries to your `code/package.json` scripts, copy `UPGRADE.md` to your root (it is template-owned from now on). Then run `npm run bocode:selftest` (green), `npm run bocode:upgrade -- --check`, `--apply` (pass `--skills-dir <dir>` so the four skills re-install β€” stale installed skills are the top reason an upgraded repo still behaves old), and rerun until `--verify` is green. If you kept `scripts/check-release-changelog.mjs`, re-copy it too β€” it now imports the manifest. Do not skip the skills re-install; do not declare the sync done from the CHANGELOG reading alone β€” the verify exit code is the only proof.

## 2026-11-07 β€” trilingual readmes aligned with the current gates

The readme bodies predated two shipped changes: they said every feature runs the six gates (task tiers landed with ADR-008 β€” S runs a light channel), and they said Phase 2 waits for user approval (the stop rule has fired only on real gaps since the phase-2 alignment). The zh-CN and ja bodies also missed the what-you-gain sentence under the adoption line.
Expand Down
Loading
Loading