@sassywares/skills 0.12.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CONCEPTS.md +32 -15
  2. package/README.md +43 -36
  3. package/package.json +1 -1
  4. package/skills/sassy-overview/SKILL.md +2 -2
  5. package/skills/sassy-overview/references/identify.md +1 -1
  6. package/skills/sassy-setup/SKILL.md +12 -7
  7. package/skills/sassy-setup/assets/templates/worktrees-create +52 -0
  8. package/skills/sassy-setup/assets/templates/worktrees-remove +51 -0
  9. package/skills/sassy-setup/assets/worktree/_lib.sh +22 -55
  10. package/skills/sassy-setup/assets/worktree/create +21 -28
  11. package/skills/sassy-setup/assets/worktree/list +52 -11
  12. package/skills/sassy-setup/assets/worktree/remove +10 -83
  13. package/skills/sassy-setup/references/branching.md +2 -2
  14. package/skills/sassy-setup/references/check.md +46 -2
  15. package/skills/sassy-setup/references/config.md +70 -100
  16. package/skills/sassy-setup/references/dogfood.md +3 -3
  17. package/skills/sassy-setup/references/init.md +18 -16
  18. package/skills/sassy-setup/references/scaffold-header.md +63 -0
  19. package/skills/sassy-setup/references/worktree.md +135 -86
  20. package/skills/sassy-setup/scripts/detect.sh +708 -250
  21. package/skills/sassy-setup/scripts/worktree-check.mjs +32 -1
  22. package/skills/sassy-worktree/SKILL.md +9 -12
  23. package/skills/sassy-worktree/references/create.md +10 -3
  24. package/skills/sassy-worktree/references/list.md +4 -2
  25. package/skills/sassy-worktree/references/remove.md +30 -6
  26. package/skills/sassy-setup/assets/lifecycle/down +0 -29
  27. package/skills/sassy-setup/assets/lifecycle/up +0 -34
  28. package/skills/sassy-setup/assets/worktree/prune +0 -93
  29. package/skills/sassy-worktree/references/prune.md +0 -13
@@ -85,21 +85,16 @@ hooks:
85
85
  push:
86
86
  "*":
87
87
  after_push: [] # commit.branch: current only
88
- # worktree: # worktrees only; keyed by the checkout's branch
89
- # "*":
90
- # after_create: [] # derive .env, seed, copy the session
91
- # before_remove: [] # drop the database, shut the device
92
88
  worktrees:
93
89
  enabled: false # true = a run may offer its own checkout
94
90
  dir: ~/.sassywares/worktrees # parent of the per-repo folder; ~ is allowed here
91
+ create: scripts/worktrees/create # this project's prepare step; absent = built-in
92
+ remove: scripts/worktrees/remove # this project's teardown; absent = built-in
95
93
  dogfood:
96
94
  enabled: false # true = sassy-plan writes Mode: Auto QA rows
97
95
  recipe: .sassywares/dogfood/recipe.md # the procedure
98
96
  reports: .sassywares/dogfood/reports # run output, never committed
99
97
  timeout: 900 # whole procedure, seconds
100
- # top level, not under worktrees: how this project's stack starts and stops
101
- up: just dev # <script> <args…> | <skill> <args…>; absent = no lifecycle
102
- down: just down
103
98
  ```
104
99
 
105
100
  | Key | Default | Meaning |
@@ -123,17 +118,16 @@ down: just down
123
118
  | `hooks.goal.<slug>.before_slice` | `[]` | Project steps as `sassy-goal mode:next` picks a slice, keyed by goal slug (see Goal hooks) |
124
119
  | `hooks.goal.<slug>.after_close` | `[]` | Project steps as `sassy-goal mode:close` persists the status, keyed by goal slug |
125
120
  | `hooks.push.<pattern>.after_push` | `[]` | Project steps after a push, keyed by the pushed branch (see Hooks) |
126
- | `hooks.worktree.<pattern>.<point>` | `[]` | Project steps across a checkout's life, keyed by the head branch it holds |
127
121
  | `dogfood.enabled` | `false` | `true` lets a plan write automated QA rows. Absent means `false` — manual QA, today's behavior |
128
122
  | `dogfood.recipe` | `.sassywares/dogfood/recipe.md` | The stored procedure `sassy-dogfood` executes. Its `Prove it:` step is the verdict |
129
123
  | `dogfood.reports` | `.sassywares/dogfood/reports` | Where a run writes its summary, step logs, and artifacts. Must be gitignored |
130
124
  | `dogfood.timeout` | `900` | Wall-clock for one run. A timeout is a failure, never a hang |
131
125
  | `worktrees.enabled` | `false` | `true` lets a run *offer* its own checkout; it asks, or takes one on a `worktree:on` token, and works in this checkout on `worktree:off`. Needs `commit.branch: new` |
132
126
  | `worktrees.dir` | `~/.sassywares/worktrees` | Parent of the per-repo worktree folder. The one path here that may be absolute or `~/` |
133
- | `up` | absent | How this project's stack starts: one `<script> <args…>` or `<skill> <args…>`, run in the foreground from inside a checkout. Absent means no lifecycle |
134
- | `down` | absent | How it stops: the same form. `remove` runs it before deleting a checkout. Absent means nothing to stop |
127
+ | `worktrees.create` | absent | The project's own prepare step: one executable path, no arguments. Absent uses the built-in `.sassywares/worktree/create` silently; a declared file that is missing or not executable falls back to it with a warning naming the key and the file |
128
+ | `worktrees.remove` | absent | The project's own teardown step: one executable path, no arguments. Same silent built-in for an absent key, same warning for a declared file that is missing or not executable |
135
129
 
136
- Paths are relative to the config's own directory, never to the cwd. Two exceptions: `worktrees.dir` may be absolute or start with `~/`, and a relative `up`/`down` path resolves against the checkout being started or stopped, not this file's directory.
130
+ Paths are relative to the project root — the folder holding `.sassywares/` — never to the cwd. `worktrees.dir` is the one exception: it may be absolute or start with `~/`, because it names machine-local state, not something a teammate clones. `worktrees.create` and `worktrees.remove` are relative paths and must name executable files.
137
131
 
138
132
  ## `git.repo` — the three topologies
139
133
 
@@ -332,15 +326,10 @@ targets. `hooks.pr.staging` means *PRs whose source is staging*. The exception i
332
326
  | `before_merge` | `sassy-babysit` | the PR looks ready **and** this run will merge it |
333
327
  | `after_merge` | `sassy-babysit` | this run observed the PR merged |
334
328
  | `hooks.push.after_push` | `sassy-ship` | right after a successful push under `commit.branch: current` |
335
- | `hooks.worktree.after_create` | `sassy-worktree` | just after a checkout exists, before anyone works in it |
336
- | `hooks.worktree.before_remove` | `sassy-worktree` | before the checkout is deleted — drop its database, shut its device |
337
329
  | `hooks.goal.before_slice` | `sassy-goal` | mode:next, once the slice is picked and the previous one's merge is confirmed, before the base check |
338
330
  | `hooks.goal.after_close` | `sassy-goal` | mode:close, once the goal status is persisted |
339
331
 
340
- `hooks.worktree` has the same shape and resolution as the other two kinds, keyed
341
- by the head branch the checkout holds. It needs `worktrees.enabled`; a shell
342
- script cannot dispatch a skill, so `.sassywares/worktree/remove` fails closed (exit `3`,
343
- `require-hook <name>`) until the caller has run it.
332
+ **The worktree points are gone.** `hooks.worktree` is a named error in `--check`: what a checkout prepares and disposes now lives in `worktrees.create`/`worktrees.remove` (see Lifecycle), so a shell script no longer dispatches a skill and there is no handshake to solve. Move an `after_create` step into the create script's after-the-checkout slot and a `before_remove` step into the remove script's stop slot.
344
333
 
345
334
  `hooks.push` has the same shape and resolution as `hooks.pr`, but its key is the
346
335
  pushed head branch and its only point is `after_push`. It runs only under
@@ -452,81 +441,51 @@ partial failures explicitly. Never collapse it into one status.
452
441
  fan-out means one `sassy-babysit` run per PR; merging a fan-out needs an explicit
453
442
  per-PR say-so, because one switch would merge N PRs nobody re-read.
454
443
 
455
- ## Lifecycle — `up` and `down`
444
+ ## Lifecycle — `worktrees.create` and `worktrees.remove`
456
445
 
457
- How this project's stack starts and stops. Two **top-level** keys, each naming
458
- exactly one thing:
446
+ The project owns what a checkout needs beyond git. Two keys point at two scripts
447
+ the project writes once:
459
448
 
460
449
  ```yaml
461
- up: just dev
450
+ worktrees:
451
+ create: scripts/worktrees/create
452
+ remove: scripts/worktrees/remove
462
453
  ```
463
454
 
464
- That is the whole declaration: `up` is the command word `just` and the argument
465
- `dev`. A value is split on whitespace, one argument per word, with no quote
466
- processing — `down: ./bin/down "two words"` arrives as three arguments, quotes
467
- included. The first word is the script or the skill; the rest are that thing's
468
- own arguments. A script is a relative path, an absolute path, or a word on
469
- `PATH`.
470
-
471
- **Absent means no lifecycle.** Nothing is inferred and nothing is invented:
472
- with no `up`, no run starts anything; with no `down`, `remove` deletes the
473
- checkout and says nothing was stopped. There is no default command, and no
474
- falling back to a `Makefile` target or a `package.json` script — a project that
475
- has one and wants it used says so in the key.
476
-
477
- **`up` runs in the foreground.** It owns the terminal until it is stopped with
478
- SIGTERM, and it must reap its children before it exits. A detached or daemonizing
479
- `up` is wrong here: the app outlives the call, nobody can ask it to stop, and the
480
- process holds the checkout — which is exactly what `down` then cannot kill.
481
- `down` must terminate whatever `up` started and exit once it has.
482
-
483
- **`down` runs before the checkout goes.** `remove` resolves the key after its
484
- guards pass and before deleting anything, so a failing `down` aborts the removal
485
- and a dirty checkout is never stopped on the way to a refusal. The `--hook-ok`
486
- re-run does not run `down` again: it continues the same removal, and a successful
487
- first run already stopped the stack.
488
-
489
- **A generated stub exits `78`.** That status means unimplemented, not a failure:
490
- `remove` warns loudly, names the `down:` key, and removes the checkout anyway,
491
- because a stub cannot be holding anything. Any other non-zero status still aborts
492
- the removal. A bare word that is not path-shaped may name a skill; a path-shaped
493
- value with no executable behind it is a mistake, and `remove` refuses with the
494
- value and the checkout in the message.
495
-
496
- **A skill is a value too, and a shell script cannot dispatch it.** When `down:`
497
- names a skill rather than a script, `remove` prints `require-hook <name>` and
498
- exits `3`; the agent runs that skill and re-runs with `--hook-ok`. That is the
499
- same handshake `hooks.worktree` uses — one mechanism, not two. Args after a skill
500
- name are the skill's own vocabulary, exactly like a hook entry.
501
-
502
- **The `WT_*` block is the checkout's identity.** Whoever runs the pair exports
503
- `WT_PATH`, `WT_BRANCH`, `WT_SLUG`, and `WT_NAMESPACE`; `remove` does it for
504
- `down`, and a caller that starts a stack does it for `up`. `create --env` prints
505
- the four assignments, which need exporting to reach a child process:
506
-
507
- ```bash
508
- set -a; eval "$(.sassywares/worktree/create <branch> --env)"; set +a
509
- bin/up
455
+ **One path, no arguments.** A value is relative to the project root — the folder
456
+ holding `.sassywares/` — must name an executable file, and is run bare: anything
457
+ it needs comes from its own arguments (`<branch> [--from <ref>]` for create,
458
+ `<slug|branch> [--force]` for remove) or from the checkout itself. A command line in the key would define a
459
+ second place the lifecycle lives, so `--check` fails a value with whitespace, an
460
+ absolute path, a path that walks outside the project, a list, or a block — one
461
+ path is the whole shape.
462
+
463
+ **Absent falls back silently; a declared value that is unusable warns.** With no
464
+ `create:`/`remove:` key, a run executes the built-in
465
+ `.sassywares/worktree/create|remove` and says nothing — a project that deleted the
466
+ pair means it. A key that declares a file that is missing or not executable, or a
467
+ value with whitespace or arguments, an absolute or `~/` path, `..`, a list, or a
468
+ block, falls back to the same built-in and warns on stderr naming the key and the
469
+ file:
470
+
471
+ ```text
472
+ warning: worktrees.create names 'scripts/worktrees/create' but /…/scripts/worktrees/create is missing or not executable — using the built-in .sassywares/worktree/create
510
473
  ```
511
474
 
512
- `WT_SLUG` is the branch made filesystem-safe and `WT_NAMESPACE` is the derived
513
- name for a database, a compose project, or a device — derive from them, never
514
- build a name by hand.
475
+ That is the git-only baseline: the checkout is cut or deleted and nothing is
476
+ prepared or disposed. A declared-but-unusable key is never a silent success — the
477
+ warning is the point — and a create that exits 0 without the `WT_*` lines is
478
+ reported as "checkout is real but unprepared".
515
479
 
516
- **Ports are the project's business.** The suite carries no port range and never
517
- derives one, so two checkouts running the same app will collide on the same
518
- fixed port unless the project's own `up` keeps them apart. Derive it there from
519
- the slug — a hash, because nothing here tracks claims, so a collision is possible
520
- and the script is where it surfaces:
480
+ **The scripts are the entry point.** `sassy-worktree` runs the project's pair; the
481
+ contract, the slots, and the scaffold are [`worktree.md`](worktree.md)'s and
482
+ [`scaffold-header.md`](scaffold-header.md)'s.
521
483
 
522
- ```bash
523
- PORT=$(( 3000 + $(printf '%s' "$WT_SLUG" | cksum | cut -d' ' -f1) % 100 ))
524
- ```
484
+ **Order is the script's.** Identity → stop → delete → dispose, and the slot that
485
+ holds each step, are in [`worktree.md`](worktree.md).
525
486
 
526
- Setup initializes the pair once and never touches it again: it points the keys at
527
- the command the project already declares, or writes the two stubs that exit `78`
528
- (see [`init.md`](init.md)). After that the keys and the scripts behind them are
529
- the project's.
487
+ **Legacy keys.** [`check.md`](check.md) reports them, and [`init.md`](init.md)
488
+ migrates them only when the user asks.
530
489
 
531
490
  ## Worktrees
532
491
 
@@ -537,23 +496,26 @@ namespace, so two runs never fight over a working tree.
537
496
  worktrees:
538
497
  enabled: true
539
498
  dir: ~/.sassywares/worktrees
499
+ create: scripts/worktrees/create
500
+ remove: scripts/worktrees/remove
540
501
  ```
541
502
 
542
- Two keys, no commands. The scripts in `.sassywares/worktree/` own the
543
- mechanics and `sassy-worktree` orchestrates them.
503
+ The scripts in `.sassywares/worktree/` own the git mechanics, the project's pair
504
+ owns everything else, and `sassy-worktree` runs the pair (see Lifecycle).
544
505
 
545
506
  **`enabled: true` is permission, not a default.** It makes a checkout available;
546
507
  `branching.md` still asks before a run takes one, unless the caller forwarded
547
508
  `worktree:`, and the run works in the main checkout until the answer is yes.
548
509
  Two runs only collide when they are actually parallel, and an unasked checkout
549
- relocates the work, leaves the uncommitted tree behind, and pays the setup hooks
510
+ relocates the work, leaves the uncommitted tree behind, and pays the setup step
550
511
  for a checkout nobody needed.
551
512
 
552
513
  **Putting a stack in a checkout is the project's business.** The suite carries no
553
- address and no port range, so the `up:`/`down:` pair is where a project
554
- decides how its stack comes up and, if it needs one, which port. `dir` is the one
555
- path in this file that may be absolute or start with `~/` — it names machine-local
556
- state, not something a teammate clones.
514
+ addresses, no ports, and no stack commands: how a checkout comes up, what it
515
+ installs, and what it disposes live in `create`/`remove`, and the scaffolding
516
+ slots are where a project writes them. `dir` is the one path in this file that may
517
+ be absolute or start with `~/` — it names machine-local state, not something a
518
+ teammate clones.
557
519
 
558
520
  **Two conditions.**
559
521
 
@@ -563,8 +525,9 @@ state, not something a teammate clones.
563
525
  - It needs the `repo` topology. A `workspace` root and a `none` folder have no
564
526
  git to cut a checkout from.
565
527
 
566
- The namespace, the two hooks, and every refusal are in
567
- [`worktree.md`](worktree.md).
528
+ The namespace, the four toolbox scripts, and every refusal are in
529
+ [`worktree.md`](worktree.md). The scaffold header both scripts carry is
530
+ [`scaffold-header.md`](scaffold-header.md).
568
531
 
569
532
  ## Dogfood
570
533
 
@@ -613,15 +576,14 @@ report layout, the verdict classes, and the lint are in
613
576
  - `git.remote` is required when `git.repo: workspace`; forbidden otherwise.
614
577
  `git.mirror_branch` and `repos` are workspace-only too.
615
578
  - `hooks` is allowed only with the four points under `hooks.pr`, `after_push`
616
- under `hooks.push`, `after_create`/`before_remove` under `hooks.worktree`, and
617
- `before_slice`/`after_close` under `hooks.goal`, each a list of skill names
618
- that resolve to `.agents/skills/<name>/SKILL.md`.
619
- - `up` and `down` are top-level single-line strings, each `<script> <args…>` or
620
- `<skill> <args…>`, naming exactly one thing. Never a block, a list, or a
621
- command chain (`&&`, `;`): the shell word after `down:` is resolved as one
622
- command, so a chain would be run as arguments to the first word. The value is
623
- split on whitespace, one argument per word, with no quote processing; quotes
624
- are passed through as ordinary characters.
579
+ under `hooks.push`, and `before_slice`/`after_close` under `hooks.goal`, each
580
+ a list of skill names that resolve to `.agents/skills/<name>/SKILL.md`.
581
+ `hooks.worktree` is gone and is reported as an error, never ignored.
582
+ - `worktrees.create` and `worktrees.remove` are one path each, relative to the
583
+ project root and naming an executable file. The drift and note outcomes are in
584
+ [`check.md`](check.md).
585
+ - `up`, `down`, and `hooks.worktree` are gone. `--check` reports each with the
586
+ exact line to delete, and the lifecycle now lives in the two script keys.
625
587
  - `worktrees.enabled` is `true` or `false`. A checkout must resolve outside the
626
588
  working tree and must not hold a branch `base_map` names as a base. An
627
589
  `enabled: true` with no tooling installed, or with the wrong tooling version,
@@ -652,3 +614,11 @@ the lock is reported. Both lock eras count: the definition named by the lock's
652
614
  or half-installed suite is drift even when the config itself matches the tree. A
653
615
  user-scope install (`~/.agents/skills/`) has no pin to verify; the check notes
654
616
  it, and a suite found in neither scope is noted, not drift.
617
+
618
+ A config that passes every rule can still be behind this template — a missing
619
+ block, key, comment layer, or example — and the check says so in a `template:`
620
+ note, never as drift; [`check.md`](check.md) has the outcomes. The merge that
621
+ closes it is `detect.sh --root <path> --sync --write`: it keeps every leaf the
622
+ check accepts, value and same-line trailing comment byte for byte, and takes the
623
+ rest from the template, so a comment carries the project's confirmation forward
624
+ and a malformed value is replaced.
@@ -152,7 +152,7 @@ value it needs has to resolve in both places.
152
152
  | Project | Preview line |
153
153
  |---|---|
154
154
  | Web | `the page the app serves — open it in a browser` |
155
- | Mobile | `simulator "$WT_NAMESPACE"` — booted by the `after_create` hook |
155
+ | Mobile | `simulator "$WT_NAMESPACE"` — booted by the project's `create` script |
156
156
  | Desktop | `the app window is already open` |
157
157
  | CLI | *(none — there is nothing to look at)* |
158
158
 
@@ -216,8 +216,8 @@ configured. Two things follow, and they are all this file says about it:
216
216
 
217
217
  A worktree gets a fresh, empty `session/`. When a project's provider registers a
218
218
  single callback URL, a second checkout usually cannot log in on its own, so the
219
- usual answer is to copy or link the main checkout's session in the
220
- `after_create` hook. Worth writing down, because a **cookie** is host-scoped and
219
+ usual answer is to copy or link the main checkout's session in the create script's
220
+ after-the-checkout slot. Worth writing down, because a **cookie** is host-scoped and
221
221
  crosses ports freely while a **`localStorage`** session is origin-scoped, port
222
222
  included, and has to be injected per origin — the difference looks like a broken
223
223
  transplant when it is only the wrong mechanism.
@@ -10,7 +10,7 @@ The path argument, else the working directory. `init` is the default mode; the m
10
10
 
11
11
  Run `scripts/detect.sh --root <path>`. It prints a proposed config: topology (`repo`, `workspace`, `none`), the remote name, a probed base branch, and nested repos with their bases.
12
12
 
13
- **A config that already exists is the proposal.** When `.sassywares/config.yaml` is found — an explicit `init` on a project that is already wired — the detector's output is only the starting point: take every value it **probes** (`git.repo`, `base_map`'s `"*"`, `repos`), and take every value it **emits as a default** from the existing file instead — the other `base_map` rungs, `hooks.*`, `worktrees.*`, `dogfood.*`, `pr.*`, `commit.branch`, `knowledge.*`, `artifacts.*`, and the top-level `up`/`down` pair. A default is not an answer: writing the blank slate here would retarget `"*"` away from the integration branch the project actually uses and delete its hooks. Present the result as a **diff against the file, key by key**, and ask before writing.
13
+ **A config that already exists is the proposal.** When `.sassywares/config.yaml` is found — an explicit `init` on a project that is already wired — the detector's output is only the starting point: take every value it **probes** (`git.repo`, `base_map`'s `"*"`, `repos`), and take every value it **emits as a default** from the existing file instead — the other `base_map` rungs, `hooks.*`, `worktrees.*`, `dogfood.*`, `pr.*`, `commit.branch`, `knowledge.*`, and `artifacts.*`. A default is not an answer: writing the blank slate here would retarget `"*"` away from the integration branch the project actually uses and delete its hooks. Present the result as a **diff against the file, key by key**, and ask before writing.
14
14
 
15
15
  ## 3. Ask only what detection cannot answer
16
16
 
@@ -24,25 +24,15 @@ Never re-ask what the tree already said.
24
24
  - **`commit.branch`** — default `new`: the run cuts a branch before the first change and never commits on a base branch. Offer `current` for a repo that genuinely wants work committed where it stands, and say plainly that `current` lets a run commit onto its base branch and push it, with no PR (`pr.*` and `hooks.pr` are ignored; `hooks.push` runs), and that a later `sassy-ship` run in `mode:auto` will then push to that base with no gate.
25
25
  - **`pr.*`** — default `babysit: true`, `merge: false`, `delete_branch: false`. Say plainly that `merge: true` authorizes merging every babysat PR in this project without asking.
26
26
  - **Hooks** — offer, do not impose. Ask whether the project wants steps injected at `before_create`, `after_create`, `before_merge`, or `after_merge` (or `hooks.push` `after_push`, for `commit.branch: current` only), and under which head branch (`"*"` for all). Also offer goal hooks — `before_slice` and `after_close` under `hooks.goal`, keyed by the goal slug — as base refresh, environment preparation, and boundary announcements that never touch the goal itself and leave every base level with its remote. Entries may carry args (`<skill> <args…>`); a hook skill's args are its own vocabulary. Leave them `[]` when there is nothing to add. **Never write a hook skill yourself** — hooks are project skills, and copying one of ours into that role is the fork this mechanism exists to prevent.
27
- - **Worktrees** — ask whether the project wants parallel work in this repo: a checkout per branch, each with its own derived namespace, so two runs never fight over one working tree. Say plainly what it costs and what it needs. `false` — the run works here, which is today's behaviour. `true` — a run may *offer* a checkout and takes one only on your yes, or outright when the run carries a `worktree:on` token, and `sassy-worktree` gains `create`, `list`, `remove`, and `prune`. It needs `commit.branch: new`: under `current` nothing ever cuts a branch, so the switch would do nothing — say so and leave it `false` rather than writing a setting that cannot fire. In `workspace` or `none` topology, say it is not available and write `false`. Read `references/worktree.md`. **Say what a checkout will need for this project** — install, `.env` derivation, a per-namespace database, a simulator, the session — and offer to create the hook with `sassy-skill`; **never write its body yourself**. With no hook, say plainly that every new checkout starts empty.
27
+ - **Worktrees** — ask whether the project wants parallel work in this repo: a checkout per branch, each with its own derived namespace, so two runs never fight over one working tree. Say plainly what it costs and what it needs. `false` — the run works here, which is today's behaviour. `true` — a run may *offer* a checkout and takes one only on your yes, or outright when the run carries a `worktree:on` token, and `sassy-worktree` gains `create`, `list`, and `remove`. It needs `commit.branch: new`: under `current` nothing ever cuts a branch, so the switch would do nothing — say so and leave it `false` rather than writing a setting that cannot fire. In `workspace` or `none` topology, say it is not available and write `false`. Read `references/worktree.md`. **Ask what a checkout will need for this project** and carry each confirmed need into step 6's interview, which owns the pattern menu and writes it as a labelled comment in the project's own scripts. Never a hook skill, and never a body setup writes.
28
28
  - **Dogfood** — ask whether the project wants agent QA: a stored procedure that proves a change works in the running product, which then lets `sassy-plan` write `Mode: Auto` QA rows instead of manual ones. Say plainly what each answer means. `false` — every QA row stays a human's, which is today's behavior. `true` — a plan may write Auto rows, but only for a recipe section that carries a `Prove it:` step, so the switch alone never makes a gate prove something. Write the answer explicitly either way; never leave it to inference. On yes, scaffold per step 4 and offer to run the first `sassy-dogfood mode:discover` before this run ends: yes means do it now (it is the only step that knows how to bring this app up), no means hand over the command and say the recipe stays a skeleton until it runs. Read `references/dogfood.md` and **never** write a command into the block or author the procedure: the recipe is the project's, and its first real content comes from a `sassy-dogfood mode:discover` run.
29
- - **Lifecycle** — how this project's stack starts and stops: the top-level `up:` and `down:` keys. Probe before asking — run `bash <sassy-overview skill>/scripts/identify.sh --root <path> up down` and read its `key<TAB>value<TAB>source` lines; exit `0` means the project already declares both, exit `3` means at least one is `unknown`. Two outcomes, each an offer, never an imposition:
30
- - **It answers** — a `dev`/`start`/`up`/`serve` target in a `Makefile` or `justfile`, or a compose file. When identify reports both `unknown` but an executable `dev` exists at the probed path (`bin/`, then `tool/`, then `scripts/`), that is an answer too: `up: bin/dev`. Offer each key on its own, pointing at **exactly** what was found — `up: just dev`, `down: just down`, `up: bin/dev` — naming the source identify reported or the script you found. On yes, write the keys and **write no file**: the command exists, and a copy in a downloaded script would drift from it. A key with no answer stays absent rather than becoming a guess.
31
- - **It does not** — identify left the key `unknown` and nothing else declares it, so there is nothing to point at. Offer the stubs for whichever keys are still unanswered: the two files from `assets/lifecycle/`, copied to the first of `bin/`, `tool/`, `scripts/` that exists (or a new `bin/` when none does), and set `up: <dir>/up`, `down: <dir>/down`.
32
-
33
- Declining both leaves the keys absent, which is **no lifecycle** — say it plainly and never invent a command. A file already sitting at either stub path is shown and asked about, never overwritten.
34
-
35
29
  ## 4. Write the config
36
30
 
37
31
  Build the file from the proposal plus the answers. It is written **fully commented**: every key keeps a description and its allowed values, exactly as the detector emits them. Never strip those comments to save lines — for a teammate opening the file, the comments are the documentation. If a config already exists, show what changes and ask before writing — never silently overwrite. Keep every key; an unset key falls back to its documented default, so a short file is legal when nothing deviates.
38
32
 
39
33
  **The dogfood scaffold, only when the answer was yes.** Create `.sassywares/dogfood/` holding `recipe.md` copied verbatim from `assets/dogfood-recipe.md`, and `.sassywares/.gitignore` with two lines — `/session/` and `/dogfood/reports/` — adding them to a `.gitignore` that already exists rather than replacing it. Never overwrite an existing recipe — show it and ask. The skeleton is deliberately incomplete: it carries the shape and the rules and fills in nothing, because `sassy-dogfood mode:discover` writes the procedure from what actually worked. Say so in the report — `enabled: true` is a permission, not a promise that a check exists.
40
34
 
41
- **The lifecycle pair, when step 3 accepted one.** Write `up:` and `down:` as two top-level keys, each naming one thing: the project's own declared command (`up: just dev`), or the two stub paths. They sit at the top level, never under `worktrees:`. The shape and the contract are `references/config.md`'s Lifecycle section.
42
-
43
- When there was no answer and the user accepted the stubs, copy `assets/lifecycle/up` and `assets/lifecycle/down` to `<dir>/up` and `<dir>/down` and make them executable; do not write a longer body. Their headers carry the contract, and both exit `78` while unimplemented — `remove` treats that as a warning and removes anyway, while any other non-zero status aborts.
44
-
45
- **From then on they are the project's.** Setup writes the pair once; no later run edits the keys or the stub bodies, and `check` reports an absent pair as **no lifecycle** instead of proposing one. Say in the report which two values the keys name, or that the project declares no lifecycle.
35
+ **The worktree keys and scripts are written in step 6**, once the pair exists. Nothing here writes them.
46
36
 
47
37
  ## 5. Wire the skills and the agents
48
38
 
@@ -80,9 +70,21 @@ Both install the same way: report the scope if the pieces are present, otherwise
80
70
 
81
71
  Two independent sets, each only when its answer was yes.
82
72
 
83
- - **Worktrees, `repo` topology and `worktrees.enabled: true`.** Copy every file in `assets/worktree/` flat into `.sassywares/worktree/` and make the four scripts executable. **That is the install.** They are run by path, so do not require a command runner and do not create or extend one to hold aliases: a `package.json` written into a Go, Python, or Dart project so four aliases have a home is a file the project did not ask for. When a file that already carries named commands exists (`package.json` `scripts`, `deno.json` `tasks`, `composer.json` `scripts`, a make/just target), **offer** the `worktree:<script>` aliases per `references/workspace.md`'s merge rules — append-only, proven to parse with that file's own tool, `git diff` added-lines only, restored from `HEAD` if not. Declining is a complete install. Name the scripts' path in the report either way — no version header: `--check` hashes the installed files against the copy this skill ships, not a version line. **Overwrite them without asking** when they already exist — the set is suite-owned and read-only, so a differing byte is drift for a re-run to replace, not a project edit to preserve. Read `references/worktree.md`. Do not create a worktree, and do not run a script: installing is the whole job, and the first `create` belongs to the user — a run asks, or takes one on `worktree:on`.
73
+ - **Worktrees, `repo` topology and `worktrees.enabled: true`.** Three jobs in order: the toolbox, the project's pair, and the keys that point at the pair.
74
+
75
+ **Probe `<home>`.** Take the first existing of `scripts/`, `bin/`, `tool/`, `tools/`; with none, use `tool/` for a dart/flutter stack and `scripts/` otherwise (`sassy-overview`'s `stack` breaks that tie — it is a tiebreak, not a new question). Show the choice and ask the user to confirm it: first match wins, and a wrong default is one edit.
76
+
77
+ **Install the toolbox.** Copy every file in `assets/worktree/` flat into `.sassywares/worktree/` and make the three scripts executable. **That is the install.** They are run by path, so do not require a command runner and do not create or extend one to hold aliases: a `package.json` written into a Go, Python, or Dart project so three aliases have a home is a file the project did not ask for. When a file that already carries named commands exists (`package.json` `scripts`, `deno.json` `tasks`, `composer.json` `scripts`, a make/just target), **offer** the `worktree:<script>` aliases per `references/workspace.md`'s merge rules — append-only, proven to parse with that file's own tool, `git diff` added-lines only, restored from `HEAD` if not. Declining is a complete install. Name the scripts' path in the report either way — no version header: `--check` hashes the installed files against the copy this skill ships, not a version line. **Overwrite them without asking** when they already exist — the set is suite-owned and read-only, so a differing byte is drift for a re-run to replace, not a project edit to preserve. Read `references/worktree.md`.
78
+
79
+ **Scaffold the project's pair — new files only.** Copy `assets/templates/worktrees-create` and `assets/templates/worktrees-remove` to `<home>/worktrees/create` and `<home>/worktrees/remove`, make both executable, and replace the header's `<version>` and `<YYYY-MM-DD>` with the write-time release and today's date, resolved as [`scaffold-header.md`](scaffold-header.md) says. An existing file is **never** overwritten, and a file the project deleted stays deleted: setting the keys again is the user's call, not a re-run's. The templates take exactly the toolbox's arguments and, untouched, behave exactly like calling the toolbox directly.
80
+
81
+ **Interview, then write inert stubs.** Ask what this project needs per worktree, and offer the patterns the overview/identify facts make plausible: a preview deployment, a per-worktree database, a compose namespace, a device or simulator, a derived `.env`. For each confirmed need, write one labelled comment in the right slot of the pair — pre-cut preparation in `create`'s before-the-checkout slot, post-cut preparation in its after-the-checkout slot, stopping in `remove`'s stop slot, disposal in its dispose slot. **A comment, never working code**: setup cannot verify a command it invents, so the body stays the suite call. Name the need specifically enough to act on ("drop the postgres database `$WT_NAMESPACE` created in create"), and change nothing else.
82
+
83
+ **Write the keys.** Set `worktrees.create: <home>/worktrees/create` and `worktrees.remove: <home>/worktrees/remove`, single paths relative to the project root — the folder holding `.sassywares/` — with no arguments.
84
+
85
+ Do not create a worktree, do not run either script, and do not start or stop anything: installing and scaffolding are the whole job, and the first `create` belongs to the user — a run asks, or takes one on `worktree:on`.
84
86
 
85
- What a life cycle does and does not do here: `create` runs a checkout's `hooks.worktree.after_create` and **never** `up`, because provisioning has to terminate and a running stack does not; `remove` runs the configured `down:` before it deletes, after its guards pass. Nothing in the suite starts a stack — that is the project's or the user's, run from the checkout with the `WT_*` block.
87
+ **Legacy keys, on request only.** `up:`, `down:`, and `hooks.worktree` were removed with the old lifecycle, and `--check` hard-errors on each with the exact edit. Never migrate on your own: a `mode:init` run the user asks for performs it — delete those keys, write the two new paths, and scaffold the pair as above.
86
88
  - **Workspace, `workspace` topology only.** The snapshot plus the `branches` / `pull` / `checkout-bases` git helpers, run by path. Aliases are an offer into a command file the root already has — never a `package.json` created for them. Read `references/workspace.md` and follow it.
87
89
 
88
90
  Then return to `SKILL.md` for steps 7–9.
@@ -99,4 +101,4 @@ Then return to `SKILL.md` for steps 7–9.
99
101
  | Dogfood is a pointer | The block names a recipe, a reports path, a timeout, and whether Auto rows are allowed — four keys. Never a command and never a tool: a copied command duplicates the manifest and cannot express step order. |
100
102
  | The recipe is the project's | Setup scaffolds the skeleton and stops. Authoring or "fixing" a procedure is `sassy-dogfood mode:discover`'s job, and a run may never edit the recipe to make its own failure pass. |
101
103
  | Worktrees need `new` | `worktrees.enabled: true` with `commit.branch: current` is refused, not written: nothing cuts a branch there, so the switch could never fire. |
102
- | The lifecycle is written once | `up`/`down` are initialized and then left alone: no re-run edits the keys or the stub bodies, and an absent pair is reported as **no lifecycle** rather than invented. |
104
+ | Stubs are inert | The interview writes labelled comments in the scaffolding slots, never executable code: an untouched pair behaves exactly like the git-only baseline. |
@@ -0,0 +1,63 @@
1
+ # The scaffold header
2
+
3
+ One header, one owner. Every project-owned file the suite plants **outside**
4
+ `.sassywares/` — today the worktree `create`/`remove` pair, and any future script
5
+ or config setup writes — carries the line below. Files inside `.sassywares/` are
6
+ either suite-owned assets or carry their own H1.
7
+
8
+ A file the project already had never gets one. The worktree toolbox under
9
+ `.sassywares/worktree/` is copied, not scaffolded: it is suite-owned and carries
10
+ its own `worktree-version` line instead.
11
+
12
+ ## The bytes
13
+
14
+ ```text
15
+ # sassywares:scaffold v1 skill=<name> version=<version> date=<YYYY-MM-DD>
16
+ ```
17
+
18
+ `skill` is the suite skill that wrote it (`sassy-setup`), `date` is the day it was
19
+ written. After that line come a blank comment line and the prose block: the
20
+ file's contract — what it is called as, what it must exit with, what it must
21
+ print — and the statement that future setup runs leave it alone. The header is
22
+ part of the file; never move it below the contract.
23
+
24
+ ## What `version` means
25
+
26
+ The suite release that wrote the file **at write time**. Provenance, never a pin:
27
+
28
+ - never updated when the suite moves;
29
+ - never compared, by `--check` or by anything else;
30
+ - never drift, and never a reason to report the file as edited or stale.
31
+
32
+ The suite-owned toolbox is proven by a content hash; a scaffolded project file
33
+ has no hash at all, so an old version number there says nothing about its current
34
+ contents.
35
+
36
+ ## Resolving `<version>`
37
+
38
+ At write time, in this order:
39
+
40
+ 1. The suite's own release, when the install carries one — `version` in the
41
+ `@sassywares/skills` `package.json` beside the skill, or
42
+ `git describe --tags --abbrev=0` in a sassy-skills checkout.
43
+ 2. Otherwise the literal word `unknown`. Never guess a number and never leave the
44
+ field empty.
45
+
46
+ `skills-lock.json` cannot supply one. Its `version` is the lock format's era
47
+ (`1`, `2`, `3`) and each entry's `computedHash` is content, not a release, so a
48
+ project pinned that way still has no suite version to write down.
49
+
50
+ ## Upgrading a scaffold
51
+
52
+ Never rewrite it. A later setup run may **offer** to migrate a scaffold whose
53
+ template version has moved: show the header, the current template, and what the
54
+ project added. The answer is the user's, and migrating is editing their file with
55
+ their approval — not setup installing over it. Setup installs new files only, so a
56
+ scaffold the project deleted stays deleted until the user asks for it again.
57
+
58
+ ## Never on YAML frontmatter
59
+
60
+ A document that already starts with YAML frontmatter — a plan, a goal, a
61
+ solution, a handbook — never takes this header. The frontmatter is its metadata
62
+ and the first bytes belong to it; provenance there is `created`/`updated`, not a
63
+ comment.