@sassywares/skills 0.11.14 → 0.11.16

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.
package/CONCEPTS.md CHANGED
@@ -54,6 +54,13 @@ owns the lifecycle; the scripts in `.sassywares/worktree/` own the git.
54
54
  `~/.sassywares/worktrees/<repo>/<slug>`. It shares one object store and one
55
55
  branch lock with the main checkout, so the same branch can never be held twice
56
56
  — the property that makes it safe where a `git clone` per agent is not.
57
+ - **Permission, not a default** — `worktrees.enabled: true` means a checkout may
58
+ be offered. A run asks before taking one and otherwise works in the main
59
+ checkout: two runs only collide when they are actually parallel, and an unasked
60
+ checkout relocates the work and leaves the uncommitted tree behind. A
61
+ `worktree:on` token is the other way to say yes — the ask answered up front —
62
+ and a managed checkout that already exists for the branch is reused rather than
63
+ a second one cut.
57
64
  - **Slug** — the branch with `/` flattened (`feat/catalog` → `feat-catalog`). It
58
65
  names the directory, the port, and the registry entry.
59
66
  - **Namespace** — the slug prefixed with the repo (`shop-feat-catalog`), and the
@@ -108,13 +115,17 @@ One step of a goal: its own plan (`NN-<slug>.md`, written only when `mode:next`
108
115
 
109
116
  The append-only section of `goal.md` that `mode:check` adds to once per slice: what changed versus the plan, new decisions, impact on later slices, and gaps deferred or accepted. Every later slice's grill reads it as settled.
110
117
 
118
+ ## Goal hook
119
+
120
+ A project skill run at a goal's boundaries, declared under `hooks.goal` and keyed by the goal slug — the goal's folder under `artifacts.plans`. `before_slice` runs in `mode:next` after the previous slice's merge is confirmed and before the next slice is grilled; `after_close` runs in `mode:close` after the status is persisted, on `Done` and on a goal left `Active`. Neither may touch the goal itself (`goal.md`, the slice plan, the status); anything else — switching to the bases, pulling, rebasing, committing, pushing, migrating — is the project's call, provided every base ends level with its remote. `before_slice` fires before `mode:next` checks the base, so it can be what freshens it. Entries are idempotent, and both fail closed. They are not PR-keyed, so `commit.branch: current` does not suppress them, and since `sassy-goal` has no approval gate the mode's report names what ran, that none are declared, or where it stopped.
121
+
111
122
  ## Brief
112
123
 
113
124
  A settled in-context brief produced by `sassy-plan` when the user picks "start working" (`sassy-work`) or "implement and ship" (`sassy-lfg`). It carries the goal, decisions, constraints, work, and done-when, but no plan file and no QA tables.
114
125
 
115
126
  ## Handoff
116
127
 
117
- `sassy-handoff` in `mode:write` writes a self-contained handoff file under `/tmp/sassywares/handoffs/` and gives the user a `sassy-handoff mode:read <path>` command; `mode:read` in the fresh session summarizes what was done, why, and the current state against the tree, then asks what to do next. A skill cannot start a session, so the user opens the fresh one; the file is the only bridge, in any harness.
128
+ `sassy-handoff` in `mode:write` writes a self-contained handoff file under `/tmp/sassywares/handoffs/` and gives the user a `sassy-handoff mode:read <path>` command; `mode:read` in the fresh session summarizes what was done, why, and the current state against the tree, then asks what to do next. A skill cannot start a session, so the user opens the fresh one; the file is the only bridge, in any harness. Reaching for it is the user's call alone: no skill in the plan → work → ship pipeline writes, offers, or suggests one, and a run ends at its own report.
118
129
 
119
130
  ## Release
120
131
 
package/README.md CHANGED
@@ -89,9 +89,9 @@ Debugging:
89
89
  | **`sassy-plan`** | Grills you one question at a time through every branch of the work — pushing back, assuming nothing, sketching UI on request — until nothing is open, then offers three choices: write the plan, start working via `sassy-work`, or implement and ship via `sassy-lfg`. |
90
90
  | **`sassy-goal`** | Runs a project too big for one plan — a migration, an epic — as a goal split into slices that each ship something complete. `mode:write` (default) grills and writes the goal, `mode:next` plans the next slice via `sassy-plan`, `mode:check` validates a shipped slice and carries its lessons forward, `mode:close` verifies the whole goal. You run every step. |
91
91
  | **`sassy-scout`** | Grounds an area on demand and writes the shared grounding brief other agents read instead of re-exploring. |
92
- | **`sassy-work`** | Executes exactly one plan phase, or one in-context brief, commits after code approval, then hands off the next phase — a brief stops before ship. |
92
+ | **`sassy-work`** | Executes exactly one plan phase, or one in-context brief, commits after code approval, then stops — the next phase is a run you start. A brief stops before ship. |
93
93
  | **`sassy-lfg`** | Executes every phase of a plan, or one in-context brief, then closes out via `sassy-ship` after code approval. |
94
- | **`sassy-worktree`** | One checkout per branch, each with its own derived namespace and port, so two agents can work in one repo. `create`, `list`, `preview`, `remove`, `prune` — and `preview` brings a checkout up so you can look at it without setting it up by hand. |
94
+ | **`sassy-worktree`** | One checkout per branch, each with its own derived namespace and port, so two agents can work in one repo — taken when you ask, never because the config allows it. `create`, `list`, `preview`, `remove`, `prune` — and `preview` brings a checkout up so you can look at it without setting it up by hand. |
95
95
  | **`sassy-cycle`** | Runs one unit of work through implement → review + simplify + validate → fix → verify, with at most two verified fix passes. Also reworks finished work from requested changes or failed QA rows. |
96
96
  | **`sassy-debug`** | Diagnoses a bug, gates the fix, fixes via `sassy-work` (cycle, code approval, commit), then ships. Debug takes no mode and always leaves ship's review gate in place unless you invoke ship yourself with `mode:auto`. |
97
97
  | **`sassy-handoff`** | `mode:write` (default) writes a self-contained handoff file to `/tmp/sassywares/handoffs/` and gives you a `sassy-handoff mode:read <path>` command for a fresh session; `mode:read` explains what the handoff did, why, and where things stand now, then asks what to do next. Works in any harness. |
@@ -169,6 +169,10 @@ hooks:
169
169
  after_merge: [] # this run observed the merge
170
170
  staging: # a per-point override for one head
171
171
  before_create: []
172
+ goal: # keyed by the goal slug, not a branch
173
+ "*":
174
+ before_slice: [] # sassy-goal next: after the previous slice merges
175
+ after_close: [] # sassy-goal close: after the status is persisted
172
176
  push: # only under commit.branch: current
173
177
  "*":
174
178
  after_push: [] # right after the push succeeds
@@ -177,7 +181,7 @@ hooks:
177
181
  # after_create: [] # derive .env, seed, copy the session in
178
182
  # before_remove: [] # drop the database, shut the device
179
183
  worktrees: # parallel checkouts of this repo
180
- enabled: false # true = a run may work in its own checkout
184
+ enabled: false # true = a run may offer its own checkout
181
185
  dir: ~/.sassywares/worktrees # parent of the per-repo folder
182
186
  ports: 3000-3099 # optional; delete for a non-port preview
183
187
  dogfood: # agent QA: a stored procedure that proves a change runs
@@ -204,6 +208,11 @@ that also carries `.sassywares/config.yaml`. Anything else — another tool's
204
208
  worktree, or one cut from a ref that predates the wiring — is counted in a footer
205
209
  and left alone.
206
210
 
211
+ `enabled: true` makes a checkout **available**, never default: a run asks before it
212
+ takes one and otherwise works in the main checkout, because two runs only collide
213
+ when they are actually parallel. `sassy-worktree create` takes one whenever you
214
+ ask for it, and a run carrying `worktree:on` has already been told yes.
215
+
207
216
  `create` derives the identity from the branch and prints it — `WT_PATH`,
208
217
  `WT_SLUG`, `WT_NAMESPACE` — so a project's hook derives `.env`, a database name,
209
218
  or a simulator from one source instead of inventing its own.
@@ -233,7 +242,7 @@ refuses a dirty tree, unpushed commits, a live app, or the main checkout.
233
242
 
234
243
  ### Extending the pipeline
235
244
 
236
- A project adds its own steps by naming a skill that lives in its own `.agents/skills/`. Nothing declared means nothing runs. Keys are the **head** branch — the one a PR comes from (for `hooks.push`, the pushed branch) — and every point can be overridden per head; entries may carry args (`<skill> <args…>`).
245
+ A project adds its own steps by naming a skill that lives in its own `.agents/skills/`. Nothing declared means nothing runs. Keys are the **head** branch — the one a PR comes from (for `hooks.push`, the pushed branch) — and every point can be overridden per head, except `hooks.goal`, which is keyed by the goal slug, the goal's folder under `artifacts.plans`; entries may carry args (`<skill> <args…>`).
237
246
 
238
247
  | Hook | Runs | Typical use |
239
248
  |---|---|---|
@@ -244,8 +253,10 @@ A project adds its own steps by naming a skill that lives in its own `.agents/sk
244
253
  | `hooks.push` `after_push` | `commit.branch: current` only: after ship's push | notify, trigger a follow-up step |
245
254
  | `hooks.worktree` `after_create` | just after a checkout exists | derive `.env` and the port, seed the database, copy the session in |
246
255
  | `hooks.worktree` `before_remove` | before the checkout is deleted | drop the derived database, shut the simulator |
256
+ | `hooks.goal` `before_slice` | `sassy-goal mode:next`: after the previous slice's merge is confirmed, before the slice is grilled | switch to the bases, pull, migrate, seed |
257
+ | `hooks.goal` `after_close` | `sassy-goal mode:close`: after the goal's status is persisted | post the goal summary, notify, tear down per-slice previews |
247
258
 
248
- Hooks run in declared order, one subagent each, and fail closed: a declared skill that is missing or returns `blocked` stops the run. Which points may write, and how, is stated once in `sassy-setup`'s `references/config.md` (the hook contract). `before_merge` and `after_merge` never fire unless this run merges.
259
+ Hooks run in declared order, one subagent each, and fail closed: a declared skill that is missing or returns `blocked` stops the run. Which points may write, and how, is stated once in `sassy-setup`'s `references/config.md` (the hook contract). `before_merge` and `after_merge` never fire unless this run merges. Goal hooks may do anything except touch the goal itself, as long as every base ends level with its remote; `before_slice` fires before `mode:next` checks the base, and neither is suppressed by `commit.branch: current`.
249
260
 
250
261
  This is deliberately not a fork mechanism. A project skill that *adds* a step is a hook; one that *restates* our steps is a copy, and copies rot. Rules are not hooks either — those belong in `AGENTS.md`.
251
262
 
@@ -307,7 +318,7 @@ flowchart LR
307
318
 
308
319
  Option 1 produces a durable plan with phased slices and QA tables. Options 2 and 3 keep the whole job as one settled in-context brief and write no plan file.
309
320
 
310
- `sassy-work` handles one phase and hands off the next. `sassy-lfg` drains the whole plan in one session. Both delegate to `sassy-cycle` and stop at one gate carrying code approval plus the QA checklist; nothing is `Done`, committed, or shipped until both pass. `Manual` rows are yours to run. `Auto` rows are proved before the gate by `sassy-dogfood`, and a failed one goes back through the cycle as a finding. With an in-context brief there are no QA rows, so the gate is code approval alone.
321
+ `sassy-work` handles one phase and stops after its commit. `sassy-lfg` drains the whole plan in one session. Both delegate to `sassy-cycle` and stop at one gate carrying code approval plus the QA checklist; nothing is `Done`, committed, or shipped until both pass. `Manual` rows are yours to run. `Auto` rows are proved before the gate by `sassy-dogfood`, and a failed one goes back through the cycle as a finding. With an in-context brief there are no QA rows, so the gate is code approval alone.
311
322
 
312
323
  Inside the cycle, every finding is fixed and then **verified**: a reviewer scoped to the fix confirms each finding resolved, and checks the fix itself for anything new. Whatever is still open gets a second fix pass; anything open after that comes back `blocked` rather than looping. Critical findings, warnings, and validator gaps are fixed automatically; the simplifier's findings are applied in the same pass but never block; the reviewer's suggestions are listed at the gate for you to pick. Changes you request at the gate and QA rows that fail go through the same loop as findings, then the gate comes back.
313
324
 
@@ -331,9 +342,9 @@ flowchart LR
331
342
  I --> J[Goal Done, rides the last PR]
332
343
  ```
333
344
 
334
- A goal is a folder under `artifacts.plans` holding `goal.md` and one plan per started slice (`01-<slice>.md`, `02-…`). `mode:write` grounds every affected domain once, grills only goal-level branches — slice boundaries and order, coexistence, the goal's done-when, non-goals — and pushes back on any slice that would leave a half-built layer. Each slice's plan is grilled only when `mode:next` starts it, with the goal's decisions and every carry-forward entry already settled. The slice then runs the usual work or lfg → ship path on its own branch (`feat/<goal>/<NN-slice>`); ship marks it `Shipped` and babysits the PR without merging, so the check can still land in it.
345
+ A goal is a folder under `artifacts.plans` holding `goal.md` and one plan per started slice (`01-<slice>.md`, `02-…`). `mode:write` grounds every affected domain once, grills only goal-level branches — slice boundaries and order, coexistence, the goal's done-when, non-goals — and pushes back on any slice that would leave a half-built layer. Each slice's plan is grilled only when `mode:next` starts it, with the goal's decisions and every carry-forward entry already settled; before that grill, and once the previous slice's merge is confirmed, `mode:next` runs the project's `before_slice` steps. The slice then runs the usual work or lfg → ship path on its own branch (`feat/<goal>/<NN-slice>`); ship marks it `Shipped` and babysits the PR without merging, so the check can still land in it.
335
346
 
336
- `mode:check` runs on the slice branch before the PR merges: it validates the whole slice plan against the branch's commits, and every gap is fixed now, deferred to a named later slice, or accepted with a reason. It appends the slice's carry-forward entry, marks it `Done` with its PR link, and pushes `goal.md` into the same PR. After the last slice, `mode:close` checks the goal's done-when against the whole tree and marks the goal `Done` in the last PR. One slice is in flight at a time, and nothing chains on its own.
347
+ `mode:check` runs on the slice branch before the PR merges: it validates the whole slice plan against the branch's commits, and every gap is fixed now, deferred to a named later slice, or accepted with a reason. It appends the slice's carry-forward entry, marks it `Done` with its PR link, and pushes `goal.md` into the same PR. After the last slice, `mode:close` checks the goal's done-when against the whole tree and marks the goal `Done` in the last PR, then runs the project's `after_close` steps once the status is persisted. One slice is in flight at a time, and nothing chains on its own.
337
348
 
338
349
  ### From bug to ship
339
350
 
@@ -379,17 +390,21 @@ The artifact decides QA: a plan document carries QA tables that gate phase compl
379
390
 
380
391
  ## Branching
381
392
 
382
- `sassy-work`, `sassy-lfg`, and `sassy-debug` decide the branch **before they touch code**, from `commit.branch` (default `new`) compared against `base_map`. On `new`, the run cuts a branch and every commit — phases, docs, ship — lands on it, so no change ever exists on a base branch. A run that is already on a branch that is not a base reuses it, which is how a handed-off phase, a resumed run, or `sassy-lfg` after `sassy-work` converges instead of cutting a second branch.
393
+ `sassy-work`, `sassy-lfg`, and `sassy-debug` decide the branch **before they touch code**, from `commit.branch` (default `new`) compared against `base_map`. On `new`, the run cuts a branch and every commit — phases, docs, ship — lands on it, so no change ever exists on a base branch. A run that is already on a branch that is not a base reuses it, which is how a resumed run, a second `sassy-work` for the next phase, or `sassy-lfg` after `sassy-work` converges instead of cutting a second branch.
383
394
 
384
- With `worktrees.enabled`, `create` runs in a worktree instead of checking out in
385
- place, so the branch and its checkout appear together; the rest of the run works
386
- in `WT_PATH` and the main checkout stays read-only. A run that finds itself on a
387
- non-base branch reuses it, which is what keeps a resumed phase inside the
388
- worktree the first one cut.
395
+ With `worktrees.enabled`, a run **offers** a worktree when it cuts a branch and
396
+ takes one only if you say yes: the branch and its checkout appear together, the
397
+ rest of the run works in `WT_PATH`, and the main checkout stays read-only. Say no
398
+ and the branch is cut in place, as usual. A run that finds itself on a non-base
399
+ branch reuses it, which is what keeps a resumed run inside the worktree the first
400
+ one took. Say yes up front instead with `worktree:on` — no offer, and a managed
401
+ checkout that already exists for the branch is reused — or stop the offer with
402
+ `worktree:off`. `worktree:on` fails closed when `worktrees.enabled` is off, in a
403
+ workspace or a folder with no git, or under `commit.branch: current`.
389
404
 
390
405
  A base is **any `base_map` value**, not just the remote default: in a repo whose `"*"` targets `staging`, standing on `staging` counts as standing on a base. That distinction is the whole point of the key — see [`skills/sassy-setup/references/branching.md`](skills/sassy-setup/references/branching.md).
391
406
 
392
- The three skills take `branch:infer|current|new` to override the config's branching for one run (the no-PR close-out follows the config `commit.branch: current` regardless of the token): `infer` (default) means the config decides, `new` forces a branch, `current` commits where you stand; it does not skip the PR. Only `commit.branch: current` in the config makes the close-out push to the upstream with no PR, hooks, or babysit. `sassy-ship` never creates a branch; finding the head on a base branch with unpublished commits is a stop-and-ask, except under `commit.branch: current`, where they are pushed along.
407
+ The three skills take `branch:infer|current|new` to override the config's branching for one run (the no-PR close-out follows the config `commit.branch: current` regardless of the token): `infer` (default) means the config decides, `new` forces a branch, `current` commits where you stand; it does not skip the PR. They also take `worktree:on|off` to answer the checkout question before it is asked: `on` takes a checkout without asking, `off` cuts the branch in place even with `worktrees.enabled`, and both are no-ops on a reused branch, so a second run never cuts a second checkout. Only `commit.branch: current` in the config makes the close-out push to the upstream with no PR, hooks, or babysit. `sassy-ship` never creates a branch; finding the head on a base branch with unpublished commits is a stop-and-ask, except under `commit.branch: current`, where they are pushed along.
393
408
 
394
409
  ## Installation
395
410
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassywares/skills",
3
- "version": "0.11.14",
3
+ "version": "0.11.16",
4
4
  "description": "Lean, explicit-invocation Agent Skills for shipping fast: plan, work, review, validate, ship.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -5,7 +5,7 @@ description: >-
5
5
  through sassy-work (quality cycle, code approval, commit), and finally ship
6
6
  it through sassy-ship. Never auto-commits. Use when asked to
7
7
  debug or fix a failure.
8
- argument-hint: "[issue reference, error message, test path, or description] [branch:infer|current|new]"
8
+ argument-hint: "[issue reference, error message, test path, or description] [branch:infer|current|new] [worktree:on|off]"
9
9
  ---
10
10
 
11
11
  # Sassy Debug
@@ -60,7 +60,7 @@ This gate is mandatory even when the original request said "fix the bug". Do not
60
60
 
61
61
  ### Option 1 — Fix it now
62
62
 
63
- Load the `sassy-work` skill on its brief path, forwarding this run's `branch:` token if it was given, with:
63
+ Load the `sassy-work` skill on its brief path, forwarding this run's `branch:` and `worktree:` tokens if they were given, with:
64
64
 
65
65
  - work brief = "Fix the root cause: <causal chain>. Apply the smallest change; add or strengthen the regression test first."
66
66
  - intent reference = the diagnosis from Phase 1
@@ -20,7 +20,7 @@ argument-hint: "<idea | goal path> [mode:write|next|check|close] [slice:<ID>]"
20
20
 
21
21
  **The user drives every step.** Each mode ends by printing the next command; nothing chains on its own. This skill never implements: code changes belong to `sassy-work`, `sassy-lfg`, and `sassy-cycle`.
22
22
 
23
- **Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. Precedence: explicit token > session instruction > config > skill default. Goals live under `artifacts.plans`; `git.repo` and `commit.branch` decide how check and close persist.
23
+ **Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. Precedence: explicit token > session instruction > config > skill default. Goals live under `artifacts.plans`; `git.repo` and `commit.branch` decide how check and close persist. `hooks.goal.<slug>` decides the project steps `mode:next` and `mode:close` fire.
24
24
 
25
25
  **Harness.** Loading another skill, dispatching an agent, and any command you hand the user follow the `sassy-setup` skill's `references/harness.md`. Read it once per run, before the first of those.
26
26
 
@@ -35,9 +35,9 @@ Slice statuses run `Pending` > `Planned` > `Shipped` > `Done`, plus `Blocked`. `
35
35
  | Mode | Load | Runs | It ends with |
36
36
  |---|---|---|---|
37
37
  | `write` (default) | `references/write.md` | anytime | a new or revised `goal.md`, and the `mode:next` command |
38
- | `next` | `references/next.md` | on the base, previous slice merged | the slice's plan written, the slice `Planned`, and the work / lfg commands |
38
+ | `next` | `references/next.md` | previous slice merged; on the base once `before_slice` has run | the `before_slice` hooks run, the slice's plan written, the slice `Planned`, and the work / lfg commands |
39
39
  | `check` | `references/check.md` | on the slice branch after ship, before merge | the slice `Done`, carry-forward appended, pushed with the slice |
40
- | `close` | `references/close.md` | on the last slice's branch after its check, before merge | `**Status:** Done` (or `Active` with a slice to add), pushed with the last slice |
40
+ | `close` | `references/close.md` | on the last slice's branch after its check, before merge | `**Status:** Done` (or `Active` with a slice to add), pushed with the last slice, then the `after_close` hooks run |
41
41
 
42
42
  Resolve the mode: an explicit `mode:` token wins. With none, it is `write` — an idea creates a goal, a path to an existing goal folder or `goal.md` revises it. Read the one reference for that mode **and only that one**.
43
43
 
@@ -51,7 +51,20 @@ write → next → work/lfg → ship → check → next → … → ship → che
51
51
 
52
52
  - **A remote** — dispatch a `worker`: *load the `sassy-commit-push-pr` skill and follow it with `branch:current` and `babysit:off`*, which commits, pushes, and updates the slice's open PR. Under `commit.branch: current` there is no PR: the worker loads `sassy-commit` with `branch:current`, then pushes the head to its upstream — never forced; a non-fast-forward rejection is a stop-and-report.
53
53
  - **`workspace`** — commit each affected repo on the run's shared branch, run `.sassywares/workspace/snapshot` for `goal.md` and the docs at the root, then push each repo. A missing or outdated snapshot script is a blocker: say to run `sassy-setup`.
54
- - **`none`** — nothing persists. Report that `goal.md` and any fixes are uncommitted, and stop.
54
+ - **`none`** — nothing persists. Report that `goal.md` and any fixes are uncommitted, and carry on: the mode still runs its hooks and reports.
55
+
56
+ ## Hooks
57
+
58
+ `hooks.goal.<slug>` in the project config, keyed by the goal folder's name, injects the project's own steps. Resolution, entry syntax, ordering, and failure behaviour are the config reference's contract.
59
+
60
+ | Point | Owner | Fires |
61
+ |---|---|---|
62
+ | `before_slice` | `mode:next` | after the slice is picked, before the base check and the grill |
63
+ | `after_close` | `mode:close` | after the status is persisted, before the report — on `Done` and on a goal left `Active` |
64
+
65
+ - **The goal is off-limits; bases end level.** A goal hook never edits `goal.md` or the slice plan, or changes the goal status, `mode`, or `branch`. Anything else is the project's call — switch to the bases, pull, rebase, commit, push, migrate a dev database, seed, notify — provided every base it touches ends level with its remote, which `mode:next` verifies right after `before_slice`. Entries are idempotent.
66
+ - **Not PR-keyed.** `commit.branch: current` does not suppress them; they fire in `remote`, `workspace` (once, at the workspace root), and `none`.
67
+ - **Fail closed.** A missing skill or a `blocked` result stops that mode, and no plan is written on a blocked `before_slice`; the report names what ran or where it stopped. A `needs-decision` result goes to the user. This skill has no approval gate, so the report is where a hook becomes visible.
55
68
 
56
69
  ## Hard rules
57
70
 
@@ -66,6 +79,7 @@ write → next → work/lfg → ship → check → next → … → ship → che
66
79
  | Done is history | A revision never re-cuts, renumbers, or rewrites a `Done` slice or its plan. |
67
80
  | No unchosen gaps | A slice or the goal turns `Done` only when every gap is fixed, deferred to a named slice, or accepted with a recorded reason. |
68
81
  | Never default | Never push to a base branch outside `commit.branch: current`; never force-push. |
82
+ | Goal hooks fire in place | `before_slice` runs in `mode:next` after the pick and before the base check and the grill; `after_close` runs in `mode:close` after the persist and before the report. A blocked hook or a missing skill stops that mode, and the report names what ran. |
69
83
 
70
84
  ## Non-goals
71
85
 
@@ -18,5 +18,6 @@ Runs on the last slice's branch after its `mode:check`, before its PR merges, so
18
18
 
19
19
  Nothing is left unchosen. With mixed choices, run the chosen fixes first.
20
20
  4. **Mark it `Done`** — only when no gap was sent to a new slice: set `**Status:** Done`. If any was, the goal stays `Active`.
21
- 5. **Persist** per the SKILL.md Persisting section, on this branch, so `goal.md` and any fixes merge with the last slice.
22
- 6. **Report** the goal path, each Done-when item with its result, and the gaps fixed, accepted, or sent to a new slice. If the goal stayed `Active`, give `/sassy-goal <goal path> mode:write` to add the slice, then `mode:next` once this PR merges. Otherwise the goal is closed when this PR merges. Persisting ran with `babysit:off`, so end with `/sassy-babysit <PR url>` in the harness's syntax.
21
+ 5. **Persist** per the SKILL.md Persisting section, on this branch, so `goal.md` and any fixes merge with the last slice. Skip step 6 if this step failed.
22
+ 6. **Run the `after_close` hooks.** No `hooks.goal.<slug>.after_close` entry resolves for this goal's slug → skip in one line. Otherwise resolve them per the `sassy-setup` skill's `references/config.md` and run each in declared order, one `worker` each. The status is already persisted, so a blocked hook cannot rewrite it. Brief them with the goal path and slug, `goal_status` (`Done`, or `Active` when a gap went to a new slice), every slice's ID, status, and PR link, and the commit hash the persist step wrote, where it wrote one (per repo in a workspace, absent under `none`). A missing skill or a `blocked` result → report `stopped at <name>`, keep everything already persisted, never retry on your own, and do not claim the close-out succeeded; the user re-runs the hook and continues. A `needs-decision` result goes to the user, and the run stops there too.
23
+ 7. **Report** the goal path, each Done-when item with its result, the gaps fixed, accepted, or sent to a new slice, and the hook outcome — `ran: <names>`, `none declared`, or `stopped at <name>`. If the goal stayed `Active`, give `/sassy-goal <goal path> mode:write` to add the slice, then `mode:next` once this PR merges. Otherwise the goal is closed when this PR merges. Persisting ran with `babysit:off`, so end with `/sassy-babysit <PR url>` in the harness's syntax.
@@ -13,7 +13,7 @@ A goal is a folder under `artifacts.plans`:
13
13
  └── 02-<slice-slug>.md # S2's plan, written when S2 starts
14
14
  ```
15
15
 
16
- The goal slug is made the way `sassy-plan` makes a plan slug. `NN` is the slice's order and matches its ID: `S1` → `01-`, `S2` → `02-`. A slice plan is an ordinary sassy plan, so `sassy-work`, `sassy-lfg`, `sassy-ship`, and `sassy-validate` run on it unchanged.
16
+ The goal slug is made the way `sassy-plan` makes a plan slug. The goal folder's name **is** the goal slug, and it is what keys `hooks.goal.<slug>` in the project config. `NN` is the slice's order and matches its ID: `S1` → `01-`, `S2` → `02-`. A slice plan is an ordinary sassy plan, so `sassy-work`, `sassy-lfg`, `sassy-ship`, and `sassy-validate` run on it unchanged.
17
17
 
18
18
  ## Rules
19
19
 
@@ -2,12 +2,13 @@
2
2
 
3
3
  **One slice in flight.** This mode starts exactly one slice by planning it. It never implements, never plans a second slice, and never runs work or lfg itself.
4
4
 
5
- 1. **Start from a fresh base.** The slice's branch is cut later by `sassy-work` or `sassy-lfg`, and a run standing on a non-base branch would reuse it. Dispatch a probe `worker` to `git fetch` the remote, run the `sassy-setup` skill's `scripts/detect.sh --branch` (no `--policy`), and return `state`, `head`, and whether local `<head>` equals `<remote>/<head>`. `state` must be `on-base` and the two must match. `on-branch` (usually the previous slice's merged branch), `detached`, or a base behind or ahead of its remote → tell the user to switch to the base and pull, then stop. Under `commit.branch: current` this step does not apply.
6
- 2. **Load the goal.** Only now read `goal.md`. If its status is `Done`, say so and stop.
7
- 3. **Nothing in flight.** If any slice is `Planned` or `Shipped`, stop and name what is due: a `Planned` slice needs `sassy-work` or `sassy-lfg` on its plan, a `Shipped` slice needs `mode:check`.
8
- 4. **Earlier slices merged.** Every `Done` slice's PR must be merged before the next slice starts, or the new slice is built on code that may still change. Dispatch a `worker` to check each PR with `gh pr view <url> --json state` and return the states. Under `commit.branch: current`, `git.repo: workspace`, or `git.repo: none` — or when a slice has no PR link — ask the user to confirm instead. Anything unmerged → stop and say which PR must merge first.
9
- 5. **Pick the slice.** The first `Pending` slice whose Depends are all `Done`. A `slice:<ID>` token overrides the pick, but its Depends must still be `Done`; a slice that is not `Pending` is a stop. No eligible slice → if every slice is `Done`, point at `mode:close`; otherwise report what blocks each `Pending` slice and stop.
10
- 6. **Plan it.** Load the `sassy-plan` skill and follow it, with:
5
+ 1. **Load the goal.** Read `goal.md`. If its status is `Done`, say so and stop. The run may still stand on the previous slice's branch here; step 6 settles the base.
6
+ 2. **Nothing in flight.** If any slice is `Planned` or `Shipped`, stop and name what is due: a `Planned` slice needs `sassy-work` or `sassy-lfg` on its plan, a `Shipped` slice needs `mode:check`.
7
+ 3. **Earlier slices merged.** Every `Done` slice's PR must be merged before the next slice starts, or the new slice is built on code that may still change. Dispatch a `worker` to check each PR with `gh pr view <url> --json state` and return the states. Under `commit.branch: current`, `git.repo: workspace`, or `git.repo: none` — or when a slice has no PR link — ask the user to confirm instead. Anything unmerged → stop and say which PR must merge first.
8
+ 4. **Pick the slice.** The first `Pending` slice whose Depends are all `Done`. A `slice:<ID>` token overrides the pick, but its Depends must still be `Done`; a slice that is not `Pending` is a stop. No eligible slice → if every slice is `Done`, point at `mode:close`; otherwise report what blocks each `Pending` slice and stop.
9
+ 5. **Run the `before_slice` hooks.** No `hooks.goal.<slug>.before_slice` entry resolves for this goal's slug → skip in one line. Otherwise resolve them per the `sassy-setup` skill's `references/config.md` and run each in declared order, one `worker` each, briefed with the goal path and slug, the slice ID and title, the plan path that is about to be written, the base and head branches, and the previous slice's PR URL. They run **before** the base check on purpose: a hook may switch each repo to its base, pull, rebase, and migrate, so the base step verifies what the hooks left. A missing skill or a `blocked` result stops the run here, **before** the grill: report which entry stopped it and why, and the recovery — fix the hook, then re-run `mode:next`. No plan is written on an unprepared environment. A `needs-decision` result goes to the user, and the run stops there too.
10
+ 6. **Verify a fresh base.** The slice's branch is cut later by `sassy-work` or `sassy-lfg`, and a run standing on a non-base branch would reuse it. Dispatch a probe `worker` to `git fetch` the remote, run the `sassy-setup` skill's `scripts/detect.sh --branch` (no `--policy`), and return `state`, `head`, and whether local `<head>` equals `<remote>/<head>`. `state` must be `on-base` and the two must match. `on-branch` (usually the previous slice's merged branch), `detached`, or a base behind or ahead of its remote → stop: tell the user to switch to the base and pull, and when hooks ran in step 5, name them as having left it that way. If the head changed since step 1, re-read `goal.md` and confirm the pick still holds. Under `commit.branch: current` this step does not apply.
11
+ 7. **Plan it.** Load the `sassy-plan` skill and follow it, with:
11
12
  - **frame** = the slice's Ships, Scope, and Done when from `goal.md`
12
13
  - **settled** = the goal's Decisions and Constraints, and every Carry-forward entry — enter them in the ledger as settled with their provenance; never re-ask them
13
14
  - **context** = the goal path, the goal's Landscape and Coexistence rows for this slice's domains, and the Deferred items addressed to this slice
@@ -15,9 +16,9 @@
15
16
 
16
17
  `sassy-plan` grills the slice in full — this is where its detail gets decided — writes the plan to that path, skips its picker, and returns the path.
17
18
 
18
- **Interrupted run.** If an `NN-*.md` for this slice already exists while the slice is still `Pending`, an earlier run stopped after writing it. Pass that file to `sassy-plan` as the `out:` path and the existing plan, so it updates it in place per its existing-plan rule instead of re-grilling from scratch.
19
- 7. **Mark it `Planned`.** In the slice table set the slice `Planned` and the Plan cell to the plan link. Commit nothing. The plan and `goal.md` ride onto the slice's branch when `sassy-work` or `sassy-lfg` cuts it. Their commits name the plan, not `goal.md`, so the `Planned` mark stays uncommitted on the slice branch until `sassy-ship`'s step 4 commit, which sets it `Shipped`.
20
- 8. **Hand over.** Report the plan path and print both commands in the harness's syntax, then stop:
19
+ **Interrupted run.** If an `NN-*.md` for this slice already exists while the slice is still `Pending`, an earlier run stopped after writing it. Pass that file to `sassy-plan` as the `out:` path and the existing plan, so it updates it in place per its existing-plan rule instead of re-grilling from scratch. A resumed run re-fires the `before_slice` hooks, which is why they must be idempotent.
20
+ 8. **Mark it `Planned`.** In the slice table set the slice `Planned` and the Plan cell to the plan link. Commit nothing. The plan and `goal.md` ride onto the slice's branch when `sassy-work` or `sassy-lfg` cuts it. Their commits name the plan, not `goal.md`, so the `Planned` mark stays uncommitted on the slice branch until `sassy-ship`'s step 4 commit, which sets it `Shipped`.
21
+ 9. **Hand over.** Report the plan path, name the hook outcome — `ran: <names>` or `none declared` — and print both commands in the harness's syntax, then stop:
21
22
 
22
23
  ```text
23
24
  S<n> planned at <plan path>. Pick one:
@@ -5,8 +5,8 @@ description: >-
5
5
  self-contained handoff file under /tmp/sassywares and gives the user a
6
6
  command to continue in a fresh session; mode:read takes a handoff file,
7
7
  explains what was done, why, and where things stand, then asks what to do
8
- next. Use at a phase boundary, when context is getting long, when the user
9
- asks to hand off, or to pick up a handoff file.
8
+ next. Use when the user asks to hand off or to pick up a handoff file — it is
9
+ never proposed on the model's own initiative.
10
10
  argument-hint: "[mode:write|read] [goal for the next session | handoff file path]"
11
11
  ---
12
12
 
@@ -63,4 +63,5 @@ Anything unresolved, and anything the next session must not do.
63
63
  - **Pointer-first.** Plan paths, phases, files, and decisions are named, not reproduced. The plan is the source of truth; the file points at it.
64
64
  - **Outside the repo.** Handoff files live under `/tmp/sassywares/` only — never committed, never inside the working tree.
65
65
  - **No secrets.** A handoff file never carries credentials, tokens, or unrelated personal data, and `read` never echoes one.
66
+ - **The user's call alone.** No skill in the plan → work → ship pipeline writes, offers, or suggests a handoff. Run this only when the user asks for one; a run that reaches a natural stopping point reports and ends there.
66
67
  - **The skill does not switch sessions.** Never claim it did.
@@ -1,7 +1,7 @@
1
1
  # Mode: write — capture the session for a fresh one
2
2
 
3
3
  1. **Determine the continuation goal.**
4
- - At a sassy plan phase boundary: the next phase that is not `Done`, continued by invoking `sassy-work <plan> phase:<n>`.
4
+ - When the user stops after a phase: the next phase that is not `Done`, continued by invoking `sassy-work <plan> phase:<n>`.
5
5
  - After a `sassy-plan` run that kept the work in a brief instead of writing a plan: continue from that brief. There is no plan path, so the brief itself — goal, decisions, constraints, done-when — goes in the file.
6
6
  - Otherwise: the user's stated objective for the next session.
7
7
  - If the goal is genuinely unclear, ask. Do not fabricate a handoff.
@@ -4,7 +4,7 @@ description: >-
4
4
  Execute a whole sassy plan phase by phase, or one settled in-context brief,
5
5
  then close out via sassy-ship after code approval. The orchestrator only
6
6
  coordinates. Best for small plans that one context can hold.
7
- argument-hint: "<plan path | brief> [branch:infer|current|new]"
7
+ argument-hint: "<plan path | brief> [branch:infer|current|new] [worktree:on|off]"
8
8
  ---
9
9
 
10
10
  # Sassy LFG
@@ -13,7 +13,7 @@ argument-hint: "<plan path | brief> [branch:infer|current|new]"
13
13
 
14
14
  **The orchestrator does not do work.** Read the plan, dispatch `sassy-cycle` per phase, then `sassy-ship`. Never edit application code. Keep the main context small — all heavy work happens in subagents.
15
15
 
16
- **Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. Precedence: explicit token > session instruction > config > skill default. Plans live under `artifacts.plans`; `git.repo` decides how the close-out persists; `commit.branch` decides whether the run needs its own branch.
16
+ **Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. Precedence: explicit token > session instruction > config > skill default. Plans live under `artifacts.plans`; `git.repo` decides how the close-out persists; `commit.branch` decides whether the run needs its own branch, and a `worktree:on|off` token answers the checkout question `branching.md` asks at step 6. The token outranks config but never widens what `worktrees.enabled` allows.
17
17
 
18
18
  **Harness.** Loading another skill, dispatching an agent, and any command you hand the user follow the `sassy-setup` skill's `references/harness.md`. Read it once per run, before the first of those.
19
19
 
@@ -42,7 +42,9 @@ A brief has no QA table, so its gate is code approval alone. Never invent, enabl
42
42
  ## Steps
43
43
 
44
44
  1. **Load the plan.** Read the plan and its Phase tracking table. If phases are already `In progress` from an interrupted run, ask once whether to resume at the gate or rerun those cycles, then continue from the answer.
45
- 2. **Resolve the branch, before touching code.** Follow the `sassy-setup` skill's `references/branching.md` with this run's `branch:` token, if any. LFG runs every phase in one session, so the branch is cut once here and every phase commits onto it. Report the branch and its start point in the gate. A `stop-and-ask` here stops the run before any phase starts.
45
+ 2. **Resolve the branch, before touching code.** Follow the `sassy-setup` skill's `references/branching.md` with this run's `branch:` and `worktree:` tokens, if any. LFG runs every phase in one session, so the branch is cut once here and every phase commits onto it. Report the branch and its start point in the gate. A `stop-and-ask` here stops the run before any phase starts.
46
+
47
+ When the decision took a checkout, every phase brief and every `sassy-dogfood` run uses the checkout's own address — `WT_PATH`, and `WT_NAMESPACE`/`WT_PORT` where the project declared a port range — since proof run against the main checkout's port proves the wrong app.
46
48
  3. **Run every phase, in order.** For each phase not `Done`:
47
49
  - Set the phase `In progress`, then load the `sassy-cycle` skill and follow it, with work brief = the phase's goal/work/"Done when", and intent reference = the plan path and phase.
48
50
  - On `Status: done`, leave the phase `In progress` — its QA rows are still owed, and only the gate closes them.
@@ -66,7 +68,7 @@ Every worker brief this run dispatches must include:
66
68
 
67
69
  When the argument is not a plan path, the brief is the one phase:
68
70
 
69
- 1. Resolve the branch exactly as the plan path does — the `sassy-setup` skill's `references/branching.md`, this run's `branch:` token — before the cycle runs.
71
+ 1. Resolve the branch exactly as the plan path does — the `sassy-setup` skill's `references/branching.md`, this run's `branch:` and `worktree:` tokens — before the cycle runs.
70
72
  2. Run one `sassy-cycle` with the brief as the work brief and its decisions / done-when as the intent reference. Do not split it into multiple phases.
71
73
  3. Present the code approval gate with no QA checklist, and wait. Changes requested → a rework cycle with the changes as findings and the brief's decisions / done-when as the intent reference, then this gate again; `blocked` stops.
72
74
  4. On code approval, run `sassy-ship`. Do not run `sassy-plan` or write a plan file.
@@ -71,4 +71,4 @@ mirrored tree. The `sassy-*` skills do their own git and never call them.
71
71
 
72
72
  ## Hooks
73
73
 
74
- `hooks.pr` names project skills that run inside the PR pipeline, keyed by the PR's **head** branch: `"*"` for every PR, an exact branch, or a family such as `release/*`, overriding per point (`before_create`, `after_create`, `before_merge`, `after_merge`). An entry is `<skill> <args…>`; the args mean whatever that skill says they mean — `mode:auto` pre-authorizes the step. Hooks are ordinary skills in `.agents/skills/`, which makes them **code**: review them like code, and never point a hook at a copy of a suite skill. Under `commit.branch: current` there is no PR, so these hooks do not run; `hooks.push` (one point, `after_push`, keyed by the pushed branch) runs there instead, right after a successful push.
74
+ `hooks.pr` names project skills that run inside the PR pipeline, keyed by the PR's **head** branch: `"*"` for every PR, an exact branch, or a family such as `release/*`, overriding per point (`before_create`, `after_create`, `before_merge`, `after_merge`). An entry is `<skill> <args…>`; the args mean whatever that skill says they mean — `mode:auto` pre-authorizes the step. Hooks are ordinary skills in `.agents/skills/`, which makes them **code**: review them like code, and never point a hook at a copy of a suite skill. Under `commit.branch: current` there is no PR, so these hooks do not run; `hooks.push` (one point, `after_push`, keyed by the pushed branch) runs there instead, right after a successful push. `hooks.goal` is the same mechanism around a goal, keyed by the goal's slug in `artifacts.plans` instead of a branch: `before_slice` runs as `sassy-goal` starts a slice and `after_close` after it persists the goal's status. Neither touches the goal itself, every base ends level with its remote, and `current` does not suppress them.
@@ -53,7 +53,9 @@ Pass `--policy` only when the **caller** asked for it — the user typed
53
53
  Never pass a token that is merely this skill's own default. Doing that launders
54
54
  a default into "explicit token", which outranks the project's config and makes
55
55
  `commit.branch` unreachable. Omitting `--policy` is how a skill defers to
56
- config. This applies to every token these skills forward, not just `branch`.
56
+ config. This applies to every token these skills forward, not just `branch`: a
57
+ `worktree:` token is carried only when the user typed it, and its absence is the
58
+ ask at step 6, never a token of its own. There is no `worktree:ask`.
57
59
 
58
60
  ## Act on `action`
59
61
 
@@ -77,18 +79,46 @@ config. This applies to every token these skills forward, not just `branch`.
77
79
  "release" is not a neutral name.
78
80
  5. If the name already exists: reuse it when it descends from `start-point`;
79
81
  stop and ask when it has diverged.
80
- 6. **Create the branch — in a worktree when the project asked for one.**
81
- With `worktrees.enabled: true` (per `worktree.md`), run the `sassy-worktree`
82
- skill's `create` for this run instead of checking out in place: it cuts the
83
- branch and the checkout together, so the branch can never be held twice, and
84
- it prints the `WT_*` namespace the run inherits. Two things follow, and both
85
- are the orchestrator's to carry:
82
+ 6. **Create the branch — in place, or in a worktree if the user says so.**
83
+ `worktrees.enabled: true` (per `worktree.md`) means this project *allows* a
84
+ checkout. It is permission, not a default: two runs only collide when they are
85
+ actually parallel, so guessing wrong moves the work to another directory,
86
+ leaves the uncommitted tree behind, and spends the `after_create` setup on a
87
+ checkout nobody needed. Ask once, here, with the branch named — *this
88
+ checkout, or a worktree of its own?* — and take the answer, **unless the
89
+ caller forwarded a `worktree:` token**, which is the user answering before
90
+ being asked. Silence is not a yes, and never ask when the answer cannot
91
+ matter: a run already on a non-base branch reuses its branch and its
92
+ checkout (`reuse`), and a human who wanted a checkout already ran
93
+ `sassy-worktree create`. With the config off, do not ask: a user who wants a
94
+ checkout anyway gets `sassy-worktree`'s refusal and the switch that turns it
95
+ on.
96
+
97
+ A forwarded token is not a second question:
98
+ - **`worktree:on`** takes the checkout without asking. It fails closed — one
99
+ line naming the reason and the switch — with `worktrees.enabled: false`,
100
+ under `git.repo: workspace` or `none`, and under `commit.branch: current`,
101
+ where nothing ever cuts a branch. It never widens what the config allows.
102
+ - **`worktree:off`** cuts the branch in place and does not ask, even with
103
+ `worktrees.enabled: true`.
104
+ - Either is a no-op on `reuse`: a run already on a non-base branch keeps its
105
+ branch and its checkout, and never creates a second one.
106
+
107
+ On yes, run the `sassy-worktree` skill's `create` for this run instead of
108
+ checking out in place: it cuts the branch and the checkout together, so no
109
+ `git checkout -b` follows and the branch can never be held twice, and it
110
+ prints the `WT_*` namespace the run inherits. `create` is idempotent: when
111
+ a managed checkout already exists for the branch, it is reused rather than a
112
+ branch cut in place, which is how a later phase of the plan, started from the
113
+ main checkout, resumes in the checkout an earlier phase made. Two things
114
+ follow, and both are the orchestrator's to carry:
86
115
  - **Every step from here on works in `WT_PATH`,** and every delegated brief
87
116
  names that absolute path. The main checkout is read-only for the rest of the
88
117
  run — config, listing, nothing else.
89
118
  - **A dirty tree does not come along,** unlike a checkout: the worktree starts
90
119
  clean from `start-point`. Say in the gate summary that uncommitted work stays
91
120
  behind, because that is a change in what a run means.
121
+
92
122
  Otherwise `git checkout -b <name> <start-point>` here, and uncommitted work
93
123
  comes along — say so in the gate summary if the tree was dirty.
94
124
  7. Report the branch, the start point, `pr-base`, and the checkout it landed in.
@@ -97,10 +127,12 @@ config. This applies to every token these skills forward, not just `branch`.
97
127
 
98
128
  Report `head` and the checkout you are in, and carry on. Do **not** re-cut because
99
129
  `commit.branch` is `new`:
100
- a second phase, a resumed run, or a handed-off session is already standing on
130
+ a second phase, a resumed run, or `sassy-lfg` after `sassy-work` is already standing on
101
131
  the branch the first one cut. That is the whole reason this is inferred rather
102
132
  than forced. It is also what keeps a run inside its own worktree: it finds itself
103
- on a non-base branch and reuses it rather than nesting another checkout.
133
+ on a non-base branch and reuses it rather than nesting another checkout. Both
134
+ `worktree:` tokens are no-ops here: the run already holds a non-base branch in
135
+ its own checkout and never cuts a second.
104
136
 
105
137
  ### `commit-here`
106
138
 
@@ -108,8 +140,11 @@ Only reachable with `policy: current`, which is an explicit statement that
108
140
  committing on the base branch is intended. Proceed, and say in the run's gate
109
141
  summary that the commits are landing on `<head>`. When the config says
110
142
  `commit.branch: current`, the close-out commits and pushes `<head>` to its upstream with **no PR** — no
111
- `sassy-commit-push-pr`, no `hooks.pr.*`, no babysit, no merge; only `hooks.push.after_push` runs. `pr-base` is
112
- irrelevant here. Never infer this from a skill default.
143
+ `sassy-commit-push-pr`, no `hooks.pr.*`, no babysit, no merge; `hooks.push.after_push` and `hooks.goal.*`
144
+ still run. `pr-base` is
145
+ irrelevant here. Never infer this from a skill default. A `worktree:on` token
146
+ cannot apply here either: nothing cuts a branch under this config, so the run
147
+ stays in this checkout and says so in one line.
113
148
 
114
149
  ### `stop-and-ask`
115
150
 
@@ -76,6 +76,12 @@ hooks:
76
76
  before_create: [tap2-version mode:auto]
77
77
  staging:
78
78
  before_create: []
79
+ goal:
80
+ "*": # keyed by the goal slug (the folder under artifacts.plans)
81
+ before_slice: [] # sassy-goal mode:next: after the previous slice merges, before the grill
82
+ after_close: [] # sassy-goal mode:close: after the status is persisted
83
+ # migration-v2: # one goal, by slug
84
+ # before_slice: [db-migrate mode:auto]
79
85
  push:
80
86
  "*":
81
87
  after_push: [] # commit.branch: current only
@@ -84,7 +90,7 @@ hooks:
84
90
  # after_create: [] # derive .env, seed, copy the session
85
91
  # before_remove: [] # drop the database, shut the device
86
92
  worktrees:
87
- enabled: false # true = a run may work in its own checkout
93
+ enabled: false # true = a run may offer its own checkout
88
94
  dir: ~/.sassywares/worktrees # parent of the per-repo folder; ~ is allowed here
89
95
  ports: 3000-3099 # optional; delete for a non-port preview
90
96
  dogfood:
@@ -112,12 +118,15 @@ dogfood:
112
118
  | `pr.merge` | `false` | `true` authorizes merging a single babysat PR |
113
119
  | `pr.delete_branch` | `false` | Delete the head branch once merged |
114
120
  | `hooks.pr.<pattern>.<point>` | `[]` | Project steps, keyed by the PR's head branch |
121
+ | `hooks.goal.<slug>.before_slice` | `[]` | Project steps as `sassy-goal mode:next` picks a slice, keyed by goal slug (see Goal hooks) |
122
+ | `hooks.goal.<slug>.after_close` | `[]` | Project steps as `sassy-goal mode:close` persists the status, keyed by goal slug |
115
123
  | `hooks.push.<pattern>.after_push` | `[]` | Project steps after a push, keyed by the pushed branch (see Hooks) |
124
+ | `hooks.worktree.<pattern>.<point>` | `[]` | Project steps across a checkout's life, keyed by the head branch it holds |
116
125
  | `dogfood.enabled` | `false` | `true` lets a plan write automated QA rows. Absent means `false` — manual QA, today's behavior |
117
126
  | `dogfood.recipe` | `.sassywares/dogfood/recipe.md` | The stored procedure `sassy-dogfood` executes. Its `Prove it:` step is the verdict |
118
127
  | `dogfood.reports` | `.sassywares/dogfood/reports` | Where a run writes its summary, step logs, and artifacts. Must be gitignored |
119
128
  | `dogfood.timeout` | `900` | Wall-clock for one run. A timeout is a failure, never a hang |
120
- | `worktrees.enabled` | `false` | `true` lets a run work in its own checkout instead of this one. Needs `commit.branch: new` |
129
+ | `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` |
121
130
  | `worktrees.dir` | `~/.sassywares/worktrees` | Parent of the per-repo worktree folder. The one path here that may be absolute or `~/` |
122
131
  | `worktrees.ports` | `3000-3099` | The range a checkout claims its private port from. **Optional**: without it a checkout holds no port and is addressed by the recipe's preview line — which is how a mobile, desktop, or CLI project previews |
123
132
 
@@ -196,8 +205,8 @@ branch from `origin/<base>` then leaves them behind entirely.
196
205
  | `new` (default) | Never commit on a base branch. Cut one first, then stay on it for the rest of the run |
197
206
 
198
207
  A branch that is already checked out and is **not** a base is reused, whatever
199
- the config says. That is what makes a second phase, a resumed run, or a
200
- handed-off session converge on the branch the first one cut instead of cutting
208
+ the config says. That is what makes a second phase, a resumed run, or
209
+ `sassy-lfg` after `sassy-work` converge on the branch the first one cut instead of cutting
201
210
  another.
202
211
 
203
212
  A base is **any `base_map` value**, plus the remote default — not the remote
@@ -207,14 +216,17 @@ phase work once got committed straight onto `staging`.
207
216
 
208
217
  Under `current` the close-out skips the PR pipeline: `pr.*` and `hooks.pr.*`
209
218
  are ignored (`before_create`, `after_create`, `before_merge`, `after_merge` never
210
- run), and there is no babysit or merge. `hooks.push.after_push` is the one hook
211
- that does run (see Hooks). A non-fast-forward push stops the run.
219
+ run), and there is no babysit or merge. `hooks.push.after_push` runs (see Hooks),
220
+ and so does `hooks.goal`, which is not PR-keyed. A non-fast-forward push stops
221
+ the run.
212
222
  Only this config value triggers it. A typed `branch:current` token, or the one
213
223
  skills forward to `sassy-commit`, does not suppress the PR.
214
224
 
215
225
  The `branch:infer|current|new` token on those skills overrides this key for one
216
- run, for branching only; the no-PR close-out follows the config
217
- `commit.branch: current` regardless of the token; `infer` means this key decides. In a workspace the key is resolved from the
226
+ run, for branching only; a `worktree:on|off` token answers the checkout question
227
+ `branching.md` asks at step 6 and leaves that branch policy alone. The no-PR
228
+ close-out follows the config `commit.branch: current` regardless of the token;
229
+ `infer` means this key decides. In a workspace the key is resolved from the
218
230
  workspace config for the whole run, one branch name in every repo; a nested
219
231
  repo whose own `commit.branch` disagrees is drift, because one run cannot follow
220
232
  two policies.
@@ -247,7 +259,10 @@ the repository considers work to land, not what every branch targets. Confirm it
247
259
  before writing.
248
260
 
249
261
  `--head <branch>` prints the resolution for one head: the base (repo topology)
250
- and all four hook points. Use it instead of merging maps by hand.
262
+ and the PR, push, and worktree hook points; it is read under `--check`, or under
263
+ `--branch`, where it names the branch to classify. `--goal <slug>` prints the two
264
+ goal points the same way, under `--check`. Use them instead of merging maps by
265
+ hand.
251
266
 
252
267
  In a `workspace`, `base_map` does not apply — there are no branches at the
253
268
  workspace level. A nested repo's base resolves in this order:
@@ -298,7 +313,8 @@ owns the moment, so they fire whichever pipeline the user started. Nothing
298
313
  declared means nothing runs.
299
314
 
300
315
  **Keys are the head branch** — the branch the PR comes from, never the one it
301
- targets. `hooks.pr.staging` means *PRs whose source is staging*.
316
+ targets. `hooks.pr.staging` means *PRs whose source is staging*. The exception is
317
+ `hooks.goal`, keyed by the goal slug (see Goal hooks below).
302
318
 
303
319
  | Key form | Matches |
304
320
  |----------|---------|
@@ -315,6 +331,8 @@ targets. `hooks.pr.staging` means *PRs whose source is staging*.
315
331
  | `hooks.push.after_push` | `sassy-ship` | right after a successful push under `commit.branch: current` |
316
332
  | `hooks.worktree.after_create` | `sassy-worktree` | just after a checkout exists, before anyone works in it |
317
333
  | `hooks.worktree.before_remove` | `sassy-worktree` | before the checkout is deleted — drop its database, shut its device |
334
+ | `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 |
335
+ | `hooks.goal.after_close` | `sassy-goal` | mode:close, once the goal status is persisted |
318
336
 
319
337
  `hooks.worktree` has the same shape and resolution as the other two kinds, keyed
320
338
  by the head branch the checkout holds. It needs `worktrees.enabled`; a shell
@@ -371,11 +389,49 @@ in review, and commented when it is deliberate.
371
389
  runs after an up-to-date push (nothing new) too.
372
390
  - **Per PR**: in a workspace fan-out the hooks run once per PR.
373
391
 
392
+ ### Goal hooks
393
+
394
+ `hooks.goal` keys on the **goal slug** — the goal's folder under
395
+ `artifacts.plans` — and resolves exactly like `hooks.pr`: exact slug, the
396
+ longest matching family, then `"*"`. Its two points are in the table above;
397
+ `sassy-goal` owns both.
398
+
399
+ - **Early stop**: neither fires when that mode stops early — an unmerged PR,
400
+ nothing eligible, or a failed persist. A stale base does not stop
401
+ `before_slice`: it fires before `mode:next` checks the base, so a hook can be
402
+ what brings the base up to date.
403
+ - **Writes**: the goal is off-limits — never an edit to `goal.md` or the slice
404
+ plan, and never a change to the goal's status, `mode`, or `branch`. Anything
405
+ else is the project's call: switch to the bases, fetch, pull, rebase, commit,
406
+ push, migrate a dev database, seed, notify. One invariant: every base the hook
407
+ touches ends **level with its remote**, because `mode:next` verifies exactly
408
+ that next and the slice branch is cut from `<remote>/<base>`. A commit left
409
+ unpushed on a base is a stop, not a slice's starting point. Entries must be
410
+ idempotent: a resumed `mode:next` re-fires `before_slice`, and a close-out
411
+ can be re-run.
412
+ - **Both outcomes**: `after_close` fires for `**Status:** Done` and for a goal
413
+ left `Active` because a gap went to a new slice. The brief carries
414
+ `goal_status` so the hook can tell them apart.
415
+ - **Not PR-keyed**: `commit.branch: current` does not suppress these, so the
416
+ `pr.*`, babysit, and merge rules that ignore `hooks.pr` under `current` do not
417
+ apply. They fire in `remote`, `workspace` (once, at the workspace root), and
418
+ `none`.
419
+ - **Visibility**: `sassy-goal` has no approval gate, so the mode's final report
420
+ names the entries that ran, that none are declared, or where it stopped.
421
+ - **Brief**: artifact paths, base, and branch, plus the goal path and slug.
422
+ `before_slice` also gets the slice ID and title, the plan path about to be
423
+ written, and the previous slice's PR URL — there are no changed files and no
424
+ slice PR yet. `after_close` also gets `goal_status`, every slice's ID, status,
425
+ and PR link, and the commit hash the persist step wrote, where it wrote one.
426
+
374
427
  ### When they do not fire
375
428
 
376
429
  `before_merge` and `after_merge` need a merge in this run. `pr.merge` defaults to
377
430
  `false`, so a project that declares them without enabling merging has inert
378
- hooks — the run says so in one line rather than skipping silently.
431
+ hooks — the run says so in one line rather than skipping silently. `hooks.goal`
432
+ never needs this run to merge anything — it fires on an observation, not on an
433
+ action — but `before_slice` still waits until every earlier slice's PR is
434
+ confirmed merged, because `mode:next` stops before it otherwise.
379
435
 
380
436
  ## Multi-repo runs
381
437
 
@@ -409,6 +465,13 @@ worktrees:
409
465
  Three keys, no commands. The scripts in `.sassywares/worktree/` own the
410
466
  mechanics and `sassy-worktree` orchestrates them.
411
467
 
468
+ **`enabled: true` is permission, not a default.** It makes a checkout available;
469
+ `branching.md` still asks before a run takes one, unless the caller forwarded
470
+ `worktree:`, and the run works in the main checkout until the answer is yes.
471
+ Two runs only collide when they are actually parallel, and an unasked checkout
472
+ relocates the work, leaves the uncommitted tree behind, and pays the setup hooks
473
+ for a checkout nobody needed.
474
+
412
475
  **A port is a resource, not the model.** Delete `ports` for an app whose preview
413
476
  is not a URL: no port is derived, `WT_PORT` and `WT_BASE_URL` are absent, and
414
477
  `list` shows the recipe's `**Preview:**` line instead. `dir` is the one path in this
@@ -418,7 +481,7 @@ something a teammate clones.
418
481
  **Two conditions.**
419
482
 
420
483
  - `enabled: true` needs `commit.branch: new`. Under `current` a run commits where
421
- it stands and never cuts a branch, so nothing would ever create a worktree;
484
+ it stands and never cuts a branch, so nothing would ever offer a worktree;
422
485
  `--check` says so rather than leaving a switch that does nothing.
423
486
  - It needs the `repo` topology. A `workspace` root and a `none` folder have no
424
487
  git to cut a checkout from.
@@ -473,8 +536,9 @@ report layout, the verdict classes, and the lint are in
473
536
  - `git.remote` is required when `git.repo: workspace`; forbidden otherwise.
474
537
  `git.mirror_branch` and `repos` are workspace-only too.
475
538
  - `hooks` is allowed only with the four points under `hooks.pr`, `after_push`
476
- under `hooks.push`, and `after_create`/`before_remove` under `hooks.worktree`,
477
- each a list of skill names that resolve to `.agents/skills/<name>/SKILL.md`.
539
+ under `hooks.push`, `after_create`/`before_remove` under `hooks.worktree`, and
540
+ `before_slice`/`after_close` under `hooks.goal`, each a list of skill names
541
+ that resolve to `.agents/skills/<name>/SKILL.md`.
478
542
  - `worktrees.enabled` is `true` or `false`; when `worktrees.ports` is present it
479
543
  is `<from>-<to>` inside 1–65535 with `<from>` no greater than `<to>`. A checkout must resolve
480
544
  outside the working tree, must not hold a branch `base_map` names as a base,
@@ -23,8 +23,8 @@ Never re-ask what the tree already said.
23
23
  - **Base map** — detection proposes `"*"` from the probed remote default. Ask where ordinary work branches from, and whether the default branch itself releases to another branch (a `staging: main` rung). Never write `main` as a guess. In `workspace` mode, show the `repos` map and get a yes on every row — a probed base is only the remote's default.
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
- - **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). 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 and port, 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 create a checkout, and `sassy-worktree` gains `create`, `list`, `preview`, `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 and the first preview will show it.
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 and port, 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`, `preview`, `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 and the first preview will show it.
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
29
 
30
30
  ## 4. Write the config
@@ -69,7 +69,7 @@ Both install the same way: report the scope if the pieces are present, otherwise
69
69
 
70
70
  Two independent sets, each only when its answer was yes.
71
71
 
72
- - **Worktrees, `repo` topology and `worktrees.enabled: true`.** Copy every file in `assets/worktree/` flat into `.sassywares/worktree/` and make the five scripts executable, then add one `worktree:<script>` alias per script to the project's manifest, append-only, exactly as the workspace aliases are. **Prove the merge**: the file must still parse (`node -p "require('./package.json')"`, or the manifest's own syntax check) and `git diff` must show only added lines plus at most one trailing comma — anything else is a rewrite, so restore the file from `HEAD` and insert again. Report the `worktree-version` you installed. **Ask before overwriting any of them when they already exist** — from the first install they are the project's files. 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 a run or to the user.
72
+ - **Worktrees, `repo` topology and `worktrees.enabled: true`.** Copy every file in `assets/worktree/` flat into `.sassywares/worktree/` and make the five scripts executable, then add one `worktree:<script>` alias per script to the project's manifest, append-only, exactly as the workspace aliases are. **Prove the merge**: the file must still parse (`node -p "require('./package.json')"`, or the manifest's own syntax check) and `git diff` must show only added lines plus at most one trailing comma — anything else is a rewrite, so restore the file from `HEAD` and insert again. Report the `worktree-version` you installed. **Ask before overwriting any of them when they already exist** — from the first install they are the project's files. 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
73
  - **Workspace, `workspace` topology only.** The snapshot plus the `branches` / `pull` / `checkout-bases` git helpers, and one `workspace:<script>` alias per script in the project's own manifest. Read `references/workspace.md` and follow it.
74
74
 
75
75
  Then return to `SKILL.md` for steps 7–9.
@@ -10,8 +10,17 @@ nested repo carries its own config, so there is nothing to cut a checkout from;
10
10
  says why, `--check` reports an `enabled: true` as drift, and the scripts refuse
11
11
  with that reason rather than "not a git repository".
12
12
 
13
- Read this when the project has `worktrees.enabled: true`, or when the user asks
14
- to run two agents in one project.
13
+ Read this when the project has `worktrees.enabled: true`, when a run is about to
14
+ cut a branch, or when the user asks to run two agents in one project.
15
+
16
+ **`enabled: true` is permission, not a default.** A run asks before it takes a
17
+ checkout — or takes one on a `worktree:on` token — and stays in the main one
18
+ otherwise: two runs only collide when they are actually parallel, and one taken
19
+ unasked moves the work to another directory, leaves the uncommitted tree behind,
20
+ and spends the `after_create` setup on a checkout nobody needed. `branching.md`
21
+ owns that ask. `sassy-worktree` runs after the answer is yes, or when a human
22
+ asks for a checkout outright; an existing managed checkout for the branch is
23
+ reused rather than a second one cut.
15
24
 
16
25
  ## Install
17
26
 
@@ -121,7 +130,7 @@ that names no port at all (a simulator, a desktop window) has nothing to probe,
121
130
 
122
131
  ## Hooks
123
132
 
124
- Two points, keyed by head branch like every other hook:
133
+ Two points, keyed by head branch like the PR hooks:
125
134
 
126
135
  ```yaml
127
136
  hooks:
@@ -192,6 +201,11 @@ implied.
192
201
  - **One worktree per run.** `references/branching.md` decides; a run already on
193
202
  a non-base branch reuses it, so a second `sassy-work` in the same checkout does
194
203
  not nest another worktree.
204
+ - **Enabled is permission, not a default.** A run offers a checkout and takes one
205
+ only on the user's yes; the main checkout is where work happens until then.
206
+ - **A `worktree:on` token is that yes.** A human asking outright is not asked
207
+ again, and a managed checkout that already exists for the branch is reused
208
+ instead of cutting a branch in place.
195
209
  - **Never operate on another worktree.** A delegation brief carries the absolute
196
210
  path of the checkout it may touch; `MAIN` is for reading config and listing.
197
211
  - **Never `git stash`.** It is repository-global: a stash taken in one worktree
@@ -202,5 +216,5 @@ implied.
202
216
  through one checkout corrupts the other. Let the package manager's store do
203
217
  the deduplicating.
204
218
  - **`worktrees.enabled` needs `commit.branch: new`.** Under `current` a run
205
- commits where it stands and never cuts a branch, so no run would ever create a
219
+ commits where it stands and never cuts a branch, so no run would ever offer a
206
220
  worktree; `--check` notes the combination.
@@ -7,6 +7,7 @@
7
7
  # Usage:
8
8
  # detect.sh [--root DIR] print a proposed config to stdout
9
9
  # detect.sh [--head BRANCH] resolve the base and hooks for one head
10
+ # detect.sh --check [--goal SLUG] resolve the goal hooks for one goal slug
10
11
  # detect.sh --branch [--policy P] resolve the branch decision for this run
11
12
  # detect.sh [--root DIR] --check compare the existing config, and the
12
13
  # vendored pin, to reality
@@ -16,10 +17,13 @@
16
17
  # is silent. --branch is read-only; it prints the decision, it never cuts.
17
18
  # --name BRANCH resolves pr-base for the name a run is about to pick, because a
18
19
  # new name can match a base_map family (release/*) and retarget the PR.
20
+ # --goal SLUG resolves the goal hooks for one goal slug, the same way --head does
21
+ # for a branch; the slug keys hooks.goal, not a branch.
19
22
  set -euo pipefail
20
23
 
21
24
  ROOT_ARG=""
22
25
  HEAD_ARG=""
26
+ GOAL_ARG=""
23
27
  POLICY_ARG=""
24
28
  NAME_ARG=""
25
29
  CHECK=0
@@ -31,13 +35,15 @@ while (( $# )); do
31
35
  --root=*) ROOT_ARG="${1#*=}" ;;
32
36
  --head) shift; [[ $# -ge 1 ]] || { echo "missing BRANCH after --head" >&2; exit 2; }; HEAD_ARG="$1" ;;
33
37
  --head=*) HEAD_ARG="${1#*=}" ;;
38
+ --goal) shift; [[ $# -ge 1 ]] || { echo "missing SLUG after --goal" >&2; exit 2; }; GOAL_ARG="$1" ;;
39
+ --goal=*) GOAL_ARG="${1#*=}" ;;
34
40
  --policy) shift; [[ $# -ge 1 ]] || { echo "missing POLICY after --policy" >&2; exit 2; }; POLICY_ARG="$1" ;;
35
41
  --policy=*) POLICY_ARG="${1#*=}" ;;
36
42
  --name) shift; [[ $# -ge 1 ]] || { echo "missing BRANCH after --name" >&2; exit 2; }; NAME_ARG="$1" ;;
37
43
  --name=*) NAME_ARG="${1#*=}" ;;
38
44
  --branch) BRANCH=1 ;;
39
45
  --check) CHECK=1 ;;
40
- -h|--help) sed -n '2,15p' "${BASH_SOURCE[0]}" | sed 's|^# \{0,1\}||'; exit 0 ;;
46
+ -h|--help) sed -n '2,21p' "${BASH_SOURCE[0]}" | sed 's|^# \{0,1\}||'; exit 0 ;;
41
47
  *) echo "unknown argument: $1" >&2; exit 2 ;;
42
48
  esac
43
49
  shift
@@ -48,6 +54,12 @@ START="${ROOT_ARG:-$PWD}"
48
54
  # --branch prints a decision; --check validates a config. One at a time, or the
49
55
  # second is silently ignored.
50
56
  (( BRANCH && CHECK )) && { echo "--branch and --check are separate modes; run them one at a time" >&2; exit 2; }
57
+ # --goal resolves hooks inside --check. Anywhere else the flag would print the
58
+ # proposal and drop itself silently.
59
+ (( CHECK )) || [[ -z "$GOAL_ARG" ]] || { echo "--goal is read with --check; run them together" >&2; exit 2; }
60
+ # --head is read by --check and by --branch; standalone it would print the
61
+ # proposal and drop itself silently.
62
+ (( CHECK || BRANCH )) || [[ -z "$HEAD_ARG" ]] || { echo "--head is read with --check or --branch; run them together" >&2; exit 2; }
51
63
  # Absolute, or the walk-up loop below re-reads "." forever.
52
64
  START="$(cd "$START" && pwd -P)"
53
65
 
@@ -293,7 +305,8 @@ map_match() {
293
305
 
294
306
  base_for_head() { map_match base_map "$1"; }
295
307
 
296
- # hook_patterns [KIND] — the head patterns declared under hooks.<kind> (pr by default).
308
+ # hook_patterns [KIND] — the keys declared under hooks.<kind> (pr by default): a
309
+ # head branch, or a goal slug for hooks.goal.
297
310
  hook_patterns() {
298
311
  yaml_flat | awk -F'\t' -v us="$US" -v k="${1:-pr}" '{n=split($1,a,us); if (n==4 && a[1]=="hooks" && a[2]==k) print a[3]}' | sort -u
299
312
  }
@@ -304,6 +317,7 @@ hook_points() {
304
317
  pr) printf '%s' "before_create after_create before_merge after_merge" ;;
305
318
  push) printf '%s' "after_push" ;;
306
319
  worktree) printf '%s' "after_create before_remove" ;;
320
+ goal) printf '%s' "before_slice after_close" ;;
307
321
  esac
308
322
  }
309
323
 
@@ -613,7 +627,7 @@ if (( CHECK )); then
613
627
  if [[ -n "$(yflat "hooks${US}pr${US}before_create")" ]]; then
614
628
  bad "hooks.pr.<point> is now nested by head branch — write hooks.pr.\"*\".<point>"
615
629
  fi
616
- for kind in pr push worktree; do
630
+ for kind in pr push worktree goal; do
617
631
  while IFS= read -r pat; do
618
632
  [[ -n "$pat" ]] || continue
619
633
  case "$pat" in
@@ -637,17 +651,18 @@ if (( CHECK )); then
637
651
  done < <(hook_patterns "$kind")
638
652
  done
639
653
 
640
- # `hooks.<kind>.<head>.<point>` is the only shape. hooks.pr has four points and
641
- # hooks.push has one; any other point name is a step that never fires.
654
+ # `hooks.<kind>.<head-or-slug>.<point>` is the only shape. hooks.pr has four
655
+ # points, hooks.push one, hooks.worktree two, hooks.goal two; any other point
656
+ # name is a step that never fires.
642
657
  while IFS=$'\t' read -r depth hpath; do
643
658
  [[ -n "$depth" ]] || continue
644
659
  kind="${hpath#hooks$US}"; kind="${kind%%$US*}"
645
660
  case "$kind" in
646
- pr|push|worktree) ;;
647
- *) bad "hooks kind '$kind' is not one of pr|push|worktree"; continue ;;
661
+ pr|push|worktree|goal) ;;
662
+ *) bad "hooks kind '$kind' is not one of pr|push|worktree|goal"; continue ;;
648
663
  esac
649
664
  if [[ "$depth" != "4" ]]; then
650
- bad "hooks entry '${hpath//$US/.}' is not head -> point -> list"
665
+ bad "hooks entry '${hpath//$US/.}' is not key -> point -> list"
651
666
  continue
652
667
  fi
653
668
  point="${hpath##*$US}"
@@ -672,6 +687,14 @@ if (( CHECK )); then
672
687
  done
673
688
  fi
674
689
 
690
+ # Goal hooks are keyed by goal slug, not a branch, so they resolve on their own.
691
+ if [[ -n "$GOAL_ARG" ]]; then
692
+ for point in $(hook_points goal); do
693
+ resolved="$(hooks_for_head_point "$GOAL_ARG" "$point" goal)"
694
+ note " goal '$GOAL_ARG' → $point: $( [[ -n "$resolved" ]] && printf '%s' "$resolved" || printf 'none' )"
695
+ done
696
+ fi
697
+
675
698
  # artifacts is the one block that fails closed everywhere it is read, so a
676
699
  # bad value here is drift, not a note: a typo must not write docs outside the
677
700
  # project. Existence is not drift — the directory is created on first write.
@@ -778,7 +801,7 @@ if (( CHECK )); then
778
801
  note " worktrees: no port resource — a checkout is addressed by the recipe's preview line"
779
802
  fi
780
803
  if [[ "$(yflat "commit${US}branch" 2>/dev/null || true)" == "current" ]]; then
781
- note " worktrees.enabled with commit.branch: current — a run never cuts a branch, so no run creates one"
804
+ note " worktrees.enabled with commit.branch: current — a run never cuts a branch, so no run offers a checkout"
782
805
  fi
783
806
 
784
807
  wt_lib="$ROOT/.sassywares/worktree/_lib.sh"
@@ -1346,11 +1369,12 @@ cat <<'EOF'
1346
1369
 
1347
1370
  # --- Hooks ----------------------------------------------------------------
1348
1371
  # Project steps injected into the PR pipeline, after a push under
1349
- # commit.branch: current, or across a worktree's life, keyed by the branch — the
1350
- # branch the PR comes from, never the one it targets. `"*"` is the default;
1351
- # a name overrides per point, and `release/*` matches a family. Each entry is
1352
- # `<skill> <args…>`, resolved at .agents/skills/<name>/SKILL.md; args are passed
1353
- # to the skill verbatim. Declared order, one worker each, missing skill fails closed.
1372
+ # commit.branch: current, across a worktree's life, or around a goal. Keyed by
1373
+ # the branch — the branch the PR comes from, never the one it targets — or by the
1374
+ # goal slug for hooks.goal. `"*"` is the default; a name overrides per point, and
1375
+ # `release/*` matches a family. Each entry is `<skill> <args…>`, resolved at
1376
+ # .agents/skills/<name>/SKILL.md; args are passed to the skill verbatim. Declared
1377
+ # order, one worker each, missing skill fails closed.
1354
1378
  hooks:
1355
1379
  pr:
1356
1380
  "*":
@@ -1364,6 +1388,14 @@ cat <<'EOF'
1364
1388
  # before_create: []
1365
1389
  # release/*: # a family of heads
1366
1390
  # after_merge: [notify mode:auto]
1391
+ goal: # keyed by the goal slug (the folder under artifacts.plans)
1392
+ "*":
1393
+ EOF
1394
+ kv before_slice '[]' 30 '# sassy-goal mode:next: after the previous slice merges' ' '
1395
+ kv after_close '[]' 30 '# sassy-goal mode:close: after the status is persisted' ' '
1396
+ cat <<'EOF'
1397
+ # migration-v2: # one goal, by slug
1398
+ # before_slice: [db-migrate mode:auto]
1367
1399
  # push: # commit.branch: current only; keyed by the pushed branch
1368
1400
  # "*":
1369
1401
  # after_push: []
@@ -1377,9 +1409,10 @@ cat <<'EOF'
1377
1409
  # --- Worktrees ------------------------------------------------------------
1378
1410
  # Parallel work in one repo: a checkout per branch, each with its own derived
1379
1411
  # namespace, so two runs never fight over one working tree. enabled: true lets a
1380
- # run create one instead of working here — and needs commit.branch: new, because
1381
- # `current` never cuts a branch. The scripts in .sassywares/worktree/ own the
1382
- # mechanics; nothing else reads these values.
1412
+ # run offer one instead of working here — the run asks, and stays here unless the
1413
+ # answer is yes. It needs commit.branch: new, because `current` never cuts a
1414
+ # branch. The scripts in .sassywares/worktree/ own the mechanics; nothing else
1415
+ # reads these values.
1383
1416
  #
1384
1417
  # Repo topology only: a workspace root has no repo to cut a checkout from, and a
1385
1418
  # `none` folder has no git at all.
@@ -1389,7 +1422,7 @@ cat <<'EOF'
1389
1422
  # preview line instead (`$WT_NAMESPACE` names a simulator, a window, a path).
1390
1423
  worktrees:
1391
1424
  EOF
1392
- kv enabled false 34 '# true = a run may work in its own checkout'
1425
+ kv enabled false 34 '# true = a run may offer its own checkout'
1393
1426
  kv dir '~/.sassywares/worktrees' 34 '# parent of the per-repo folder; ~ is allowed'
1394
1427
  kv ports 3000-3099 34 '# a private port per checkout; delete for non-port previews'
1395
1428
  cat <<'EOF'
@@ -2,21 +2,21 @@
2
2
  name: sassy-work
3
3
  description: >-
4
4
  Execute exactly one phase of a sassy plan by delegating to sassy-cycle, then
5
- hand off to a fresh session for the next phase (or close out via sassy-ship if
6
- it was the last). Also runs one settled in-context brief and stops before ship.
7
- The orchestrator only coordinates.
8
- argument-hint: "<plan path | brief> [phase:<n>] [branch:infer|current|new]"
5
+ commit it (or close out via sassy-ship if it was the last). The next phase is
6
+ a run of its own when the user starts one. Also runs one settled in-context
7
+ brief and stops before ship. The orchestrator only coordinates.
8
+ argument-hint: "<plan path | brief> [phase:<n>] [branch:infer|current|new] [worktree:on|off]"
9
9
  ---
10
10
 
11
11
  # Sassy Work
12
12
 
13
- **Outcome:** one phase run through `sassy-cycle`, findings fixed, then a single gate that carries both the code approval and the phase's QA checklist (`Manual` rows from the user, `Auto` rows from a `sassy-dogfood` report), marked `Done` only when both pass, committed via `sassy-commit`; then a handoff that continues the **next** phase in a fresh session, or a `sassy-ship` close-out if this was the last phase.
13
+ **Outcome:** one phase run through `sassy-cycle`, findings fixed, then a single gate that carries both the code approval and the phase's QA checklist (`Manual` rows from the user, `Auto` rows from a `sassy-dogfood` report), marked `Done` only when both pass, committed via `sassy-commit`; then the run ends, or a `sassy-ship` close-out when this was the last phase.
14
14
 
15
15
  **Brief input** runs one cycle, presents the code approval gate, commits, and **stops before shipping**.
16
16
 
17
17
  **The orchestrator does not do work.** Read the plan, dispatch `sassy-cycle`, apply its result, update the plan's tracking table, dispatch `sassy-commit` or the snapshot, and report. Never edit application code.
18
18
 
19
- **Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. Precedence: explicit token > session instruction > config > skill default. `git.repo` decides what the phase commit does, `artifacts.plans` decides where the plan lives, and `commit.branch` decides whether this run needs its own branch.
19
+ **Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. Precedence: explicit token > session instruction > config > skill default. `git.repo` decides what the phase commit does, `artifacts.plans` decides where the plan lives, `commit.branch` decides whether this run needs its own branch, and a `worktree:on|off` token answers the checkout question `branching.md` asks at step 6. The token outranks config but never widens what `worktrees.enabled` allows.
20
20
 
21
21
  **Harness.** Loading another skill, dispatching an agent, and any command you hand the user follow the `sassy-setup` skill's `references/harness.md`. Read it once per run, before the first of those.
22
22
 
@@ -50,37 +50,34 @@ Always gate before committing. The cycle has already fixed and verified its find
50
50
  1. **Load the phase.** Read the plan and only the selected phase's section. If it is already `Done`, stop and report.
51
51
 
52
52
  If the phase is `In progress`, an earlier run was interrupted before both gates passed. Ask one question — resume at the gate, or re-run the cycle from scratch — and take the answer. Resuming skips the cycle and goes straight to step 5, but **still resolve the branch at step 2 first**: on `reuse` it is a no-op, and on `create` it is the difference between committing on the base and not.
53
- 2. **Resolve the branch, before touching code.** Follow the `sassy-setup` skill's `references/branching.md` with this run's `branch:` token, if any. On `create`, cut the branch now — not at commit time — so no change ever exists on a base branch. On `reuse`, stay where you are, which is how a handed-off later phase or a resumed run lands on the branch the first phase cut. On `stop-and-ask`, present the choice and wait. Carry the branch and its start point into every gate summary you present.
53
+ 2. **Resolve the branch, before touching code.** Follow the `sassy-setup` skill's `references/branching.md` with this run's `branch:` and `worktree:` tokens, if any. On `create`, cut the branch now — not at commit time — so no change ever exists on a base branch. On `reuse`, stay where you are, which is how a later phase or a resumed run lands on the branch the first phase cut. On `stop-and-ask`, present the choice and wait. When the decision took a checkout, every brief dispatched from here on names its absolute `WT_PATH`, as `branching.md` requires. Carry the branch, its start point, and the checkout into every gate summary you present.
54
54
  3. **Run the cycle.** Set the phase `In progress` in the Phase tracking table, then load the `sassy-cycle` skill and follow it, with:
55
55
  - work brief = the phase's goal, work items, and "Done when" criteria
56
56
  - intent reference = the plan path and phase
57
57
  4. **Evaluate the phase.** On `Status: done`, the code is ready for the gate, but leave the phase `In progress` — both gates must pass before it closes. On `Status: blocked`, set it `Blocked` in the Phase tracking table and stop; a blocked phase is a real outcome and needs no approval.
58
58
 
59
- **Then prove the `Auto` rows.** If the phase has any, run the `sassy-dogfood` skill in `mode:run` with each row's section named, before the gate and never after it. Record what each report said. A `failed` verdict is a finding, so the phase goes back through step 3's cycle with the failing step and the report's log tail as its findings, and this step runs again; a `class: env` verdict is not a finding — report that the toolchain is broken, leave the phase `In progress`, and stop. An `Auto` row with no report is `Pending`, never `Done`.
59
+ **Then prove the `Auto` rows.** If the phase has any, run the `sassy-dogfood` skill in `mode:run` with each row's section named, before the gate and never after it. When the decision took a checkout, the report runs against the checkout's own address — `WT_PATH`, and `WT_NAMESPACE`/`WT_PORT` where the project declared a port range — since proof run against the main checkout's app proves the wrong app. Record what each report said. A `failed` verdict is a finding, so the phase goes back through step 3's cycle with the failing step and the report's log tail as its findings, and this step runs again; a `class: env` verdict is not a finding — report that the toolchain is broken, leave the phase `In progress`, and stop. An `Auto` row with no report is `Pending`, never `Done`.
60
60
  5. **Present the phase gate.** Report the phase, what changed, findings raised and resolved (with the fix passes it took), the simplifications applied, the validator grade, the reviewer summary, and the reviewer's suggestions as options the user may pick. Then give the QA checklist verbatim: each row's ID, check, `Mode`, and — for `Manual` — how to run it and what passing looks like, and for `Auto` — the dogfood verdict and run id, with unreported rows `Pending`. Ask for both decisions — code approval (or the changes wanted, including any suggestions picked) and the result per `Manual` row. Wait.
61
61
  6. **Resolve the gate.** Three outcomes, nothing in between:
62
62
  - **Code approved and every QA row passes** → go to step 7.
63
- - **Code approved, `Manual` rows still pending** → record that code is approved but leave the phase `In progress`, tick nothing, commit nothing, hand off nothing, and report that the phase is waiting on manual QA plus the command that resumes it.
63
+ - **Code approved, `Manual` rows still pending** → record that code is approved but leave the phase `In progress`, tick nothing, commit nothing, and report that the phase is waiting on manual QA plus the command that resumes it.
64
64
  - **Changes requested, or any row fails** → a rework cycle: load `sassy-cycle` with the requested changes and the failing rows as its findings, and the plan path and phase as the intent reference. On `done`, re-prove the `Auto` rows (step 4) and present the gate again from step 5; on `blocked`, mark the phase `Blocked` and stop. A QA row that fails again after its rework is `Blocked` with the reason and stops the phase. Change requests have no cap — each one is the user's call.
65
65
  7. **Commit the phase.** On both gates passing, first mark the phase's QA rows `Done` — `Manual` rows with the user's notes, `Auto` rows with the verdict and run id from the report — and the phase `Done` in the Phase tracking table, then persist according to `git.repo`:
66
66
 
67
67
  - **A remote** — dispatch a `worker` whose task is: *load the `sassy-commit` skill and follow it with `branch:current`*, naming that the commit must include the phase's code changes, the QA table results, and the now-updated Phase tracking table. It returns the hash and subject. The branch already exists: step 2 cut it, so committing on it is the point of `branch:current` here.
68
68
  - **`workspace`** — dispatch a `worker` per affected repo to commit that repo's code on the run's shared branch, then run `.sassywares/workspace/snapshot` for the plan, QA results, and docs at the root. The gate's approval is the commit approval; the snapshot runs right after it and is never skipped. A missing or outdated `.sassywares/workspace/snapshot` is a blocker — say to run `sassy-setup`.
69
- - **`none`** — nothing is persisted. Report that the phase's work is uncommitted and stop; never hand off on top of it.
69
+ - **`none`** — nothing is persisted. Report that the phase's work is uncommitted and stop; nothing follows an uncommitted phase.
70
70
 
71
- Do not hand off or close out until the commit or snapshot succeeds.
71
+ Do not close out until the commit or snapshot succeeds.
72
72
  8. **On commit success:**
73
- - **A next phase exists** → load the `sassy-handoff` skill in `mode:write` with the goal *Execute phase <next> of <plan> by invoking `sassy-work <plan> phase:<next>`*. It writes the handoff file and gives the user a `sassy-handoff mode:read <path>` command; the next phase starts when they run it in a fresh session and pick it.
74
-
75
73
  - **This was the last phase** → run the close-out: load the `sassy-ship` skill and follow it (under `commit.branch: current` ship commits and pushes, with no PR).
76
-
77
- **Why a fresh session:** one phase per context keeps every phase's context small. A skill cannot start a session itself, so the handoff file is the bridge and the user opens the session.
74
+ - **Any phase is left** → report the commit and stop. Name the next phase and the command that picks it up — `sassy-work <plan>` takes the first phase that is not `Done` — and never start it in this session. Continuing, stopping for now, or choosing another executor is the user's call; do not offer or write a handoff.
78
75
 
79
76
  ## Brief input
80
77
 
81
78
  When the argument is not a plan path, it is one settled brief:
82
79
 
83
- 1. Resolve the branch exactly as the plan path does — `references/branching.md`, this run's `branch:` token — before the cycle runs.
80
+ 1. Resolve the branch exactly as the plan path does — `references/branching.md`, this run's `branch:` and `worktree:` tokens — before the cycle runs. Every brief dispatched from there names the absolute `WT_PATH` when the decision took a checkout.
84
81
  2. Run one `sassy-cycle` with the brief as the work brief and its decisions / done-when as the intent reference. Do not split it into multiple cycles.
85
82
  3. Present the code approval gate with no QA checklist, and wait. Changes requested → a rework cycle with the changes as findings and the brief's decisions / done-when as the intent reference, then this gate again; `blocked` stops.
86
83
  4. On code approval, persist the brief's changes the same way the plan path does: a `sassy-commit` delegation with `branch:current` in a remote repo, or the workspace snapshot in a workspace.
@@ -92,9 +89,11 @@ When the argument is not a plan path, it is one settled brief:
92
89
  |------|-------------|
93
90
  | Orchestrator only | Delegate all implementation and quality work to `sassy-cycle`. |
94
91
  | Branch before code | Resolve the branch per the `sassy-setup` skill's `references/branching.md` before the cycle runs, so no change ever lands on a base branch. |
92
+ | Checkout from the branch decision | When the decision took a checkout, every brief names the absolute `WT_PATH` and the main checkout stays read-only; never restate that contract, it is `branching.md`'s. |
95
93
  | One phase per run | Do exactly one phase. Never continue into the next phase in this session. |
96
- | Gate before commit and handoff | Do not commit, hand off, or close out until the user approves the code and the phase QA rows pass. |
97
- | Commit per phase | Commit the phase, its QA results, and the plan update via `sassy-commit` before handoff or close-out. |
94
+ | Gate before commit and close-out | Do not commit or close out until the user approves the code and the phase QA rows pass. |
95
+ | Commit per phase | Commit the phase, its QA results, and the plan update via `sassy-commit` before close-out. |
96
+ | Handing off is the user's | Never write a handoff or suggest one. The run ends at its report; `sassy-handoff` is invoked by the user, in their own session and on their own initiative. |
98
97
  | Done needs both gates | Mark a phase `Done` only when the user approves the code and every QA row for that phase is `Done`, never before. |
99
98
  | QA rows follow their mode | Tick a `Manual` row `Done` only from the user's explicit confirmation, and an `Auto` row only from a passing dogfood report; keep unreported rows `Pending`; a failed row is a finding for a rework cycle. |
100
99
  | Send-backs are rework | Requested changes and failed QA rows go through `sassy-cycle` as findings — verified, two fix passes at most — never a direct edit. |
@@ -103,7 +102,7 @@ When the argument is not a plan path, it is one settled brief:
103
102
  ## Failure handling
104
103
 
105
104
  - `sassy-cycle` returns `blocked` → mark the phase `Blocked`, stop, report the open findings and the diagnostic.
106
- - QA stays pending, or a row fails again after its rework → keep the phase `In progress` (or `Blocked` with the reason), commit nothing, hand off nothing, and report.
107
- - `sassy-commit` fails or leaves the phase changes uncommitted → stop and report; never hand off on top of uncommitted phase work.
108
- - The validator returns **Blocked — insufficient grounding** → treat it as a real blocker; do not advance or hand off.
105
+ - QA stays pending, or a row fails again after its rework → keep the phase `In progress` (or `Blocked` with the reason), commit nothing, and report.
106
+ - `sassy-commit` fails or leaves the phase changes uncommitted → stop and report; never close out on top of uncommitted phase work.
107
+ - The validator returns **Blocked — insufficient grounding** → treat it as a real blocker; do not advance.
109
108
  - Ambiguous or unsafe failure → stop and ask.
@@ -5,7 +5,8 @@ description: >-
5
5
  worktree per branch, each with its own derived namespace and port, created and
6
6
  torn down safely. `mode:preview` brings a checkout up so you can look at it
7
7
  without setting it up by hand. Use when asked for parallel work, a second
8
- checkout, or to see what a worktree looks like.
8
+ checkout, or to see what a worktree looks like, and when a run offers one and
9
+ the user accepts.
9
10
  argument-hint: "[slug] [mode:create|list|preview|remove|prune] [section:<name>]"
10
11
  ---
11
12
 
@@ -13,7 +14,7 @@ argument-hint: "[slug] [mode:create|list|preview|remove|prune] [section:<name>]"
13
14
 
14
15
  **Outcome:** a checkout per branch that a run or a human can use without touching the main one — created, addressed, previewed, and removed without losing work — or a table saying what exists and what is safe to delete.
15
16
 
16
- **Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. `worktrees.enabled` decides whether any of this runs; `dir` and `ports` are read by the scripts, not by you. Precedence: explicit token > session instruction > config > skill default. Read the `sassy-setup` skill's `references/worktree.md` before the first mode: it owns the directory, port, refusal, and hook rules the scripts implement.
17
+ **Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. `worktrees.enabled` decides whether a checkout is available at all — permission, never an instruction to take one; `dir` and `ports` are read by the scripts, not by you. Precedence: explicit token > session instruction > config > skill default. Read the `sassy-setup` skill's `references/worktree.md` before the first mode: it owns the directory, port, refusal, and hook rules the scripts implement.
17
18
 
18
19
  **The scripts do the git.** `.sassywares/worktree/{create,list,stop,remove,prune}` are installed by `sassy-setup` and own the mechanics: `git worktree`, the port claim, the refusals. This skill never runs `git worktree` itself, never invents a port, and never deletes a directory.
19
20
 
@@ -37,6 +38,7 @@ Resolve the mode: an explicit `mode:` token wins. With none, it is `list` — th
37
38
  |------|-------------|
38
39
  | The scripts do the git | Never run `git worktree`, never invent a port, never `rm -rf` a checkout. `.sassywares/worktree/*` owns all of it. |
39
40
  | Repo topology only | `git.repo: workspace` or `none` means no worktrees at all. Say so in one line and stop — never create a checkout inside a nested repo to work around it. |
41
+ | Enabled is permission | `worktrees.enabled: true` lets a run *offer* a checkout. `create` runs on the user's yes, or on a human asking outright — never because the config allowed it. |
40
42
  | Ours only | A checkout is managed when it sits under `worktrees.dir` **and** carries `.sassywares/config.yaml`. Never list, prune, stop, or remove one that is not — another tool made it, or it was cut before the wiring. `create` says so when that happens. |
41
43
  | Names come from the script | `WT_NAMESPACE` is derived once, and `WT_PORT` only when the project configured a range. Never build a database name, a compose project, or a device name by hand. |
42
44
  | Hooks are dispatched, not skipped | A declared `after_create` or `before_remove` runs. `remove` exits `3` rather than skipping it, and that is deliberate. |