@sassywares/skills 0.11.15 → 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
@@ -57,7 +57,10 @@ owns the lifecycle; the scripts in `.sassywares/worktree/` own the git.
57
57
  - **Permission, not a default** — `worktrees.enabled: true` means a checkout may
58
58
  be offered. A run asks before taking one and otherwise works in the main
59
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.
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.
61
64
  - **Slug** — the branch with `/` flattened (`feat/catalog` → `feat-catalog`). It
62
65
  names the directory, the port, and the registry entry.
63
66
  - **Namespace** — the slug prefixed with the repo (`shop-feat-catalog`), and the
@@ -112,6 +115,10 @@ One step of a goal: its own plan (`NN-<slug>.md`, written only when `mode:next`
112
115
 
113
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.
114
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
+
115
122
  ## Brief
116
123
 
117
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.
package/README.md CHANGED
@@ -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
@@ -207,7 +211,7 @@ and left alone.
207
211
  `enabled: true` makes a checkout **available**, never default: a run asks before it
208
212
  takes one and otherwise works in the main checkout, because two runs only collide
209
213
  when they are actually parallel. `sassy-worktree create` takes one whenever you
210
- ask for it.
214
+ ask for it, and a run carrying `worktree:on` has already been told yes.
211
215
 
212
216
  `create` derives the identity from the branch and prints it — `WT_PATH`,
213
217
  `WT_SLUG`, `WT_NAMESPACE` — so a project's hook derives `.env`, a database name,
@@ -238,7 +242,7 @@ refuses a dirty tree, unpushed commits, a live app, or the main checkout.
238
242
 
239
243
  ### Extending the pipeline
240
244
 
241
- 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…>`).
242
246
 
243
247
  | Hook | Runs | Typical use |
244
248
  |---|---|---|
@@ -249,8 +253,10 @@ A project adds its own steps by naming a skill that lives in its own `.agents/sk
249
253
  | `hooks.push` `after_push` | `commit.branch: current` only: after ship's push | notify, trigger a follow-up step |
250
254
  | `hooks.worktree` `after_create` | just after a checkout exists | derive `.env` and the port, seed the database, copy the session in |
251
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 |
252
258
 
253
- 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`.
254
260
 
255
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`.
256
262
 
@@ -336,9 +342,9 @@ flowchart LR
336
342
  I --> J[Goal Done, rides the last PR]
337
343
  ```
338
344
 
339
- 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.
340
346
 
341
- `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.
342
348
 
343
349
  ### From bug to ship
344
350
 
@@ -391,11 +397,14 @@ takes one only if you say yes: the branch and its checkout appear together, the
391
397
  rest of the run works in `WT_PATH`, and the main checkout stays read-only. Say no
392
398
  and the branch is cut in place, as usual. A run that finds itself on a non-base
393
399
  branch reuses it, which is what keeps a resumed run inside the worktree the first
394
- one took.
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`.
395
404
 
396
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).
397
406
 
398
- 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.
399
408
 
400
409
  ## Installation
401
410
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassywares/skills",
3
- "version": "0.11.15",
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:
@@ -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
 
@@ -83,17 +85,33 @@ config. This applies to every token these skills forward, not just `branch`.
83
85
  actually parallel, so guessing wrong moves the work to another directory,
84
86
  leaves the uncommitted tree behind, and spends the `after_create` setup on a
85
87
  checkout nobody needed. Ask once, here, with the branch named — *this
86
- checkout, or a worktree of its own?* — and take the answer. Silence is not a
87
- yes, and never ask when the answer cannot matter: a run standing on a non-base
88
- branch reuses its branch and its checkout (`reuse`), and a human who wanted a
89
- checkout already ran `sassy-worktree create`. With the config off, do not ask:
90
- a user who wants a checkout anyway gets `sassy-worktree`'s refusal and the
91
- switch that turns it on.
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.
92
106
 
93
107
  On yes, run the `sassy-worktree` skill's `create` for this run instead of
94
- checking out in place: it cuts the branch and the checkout together, so the
95
- branch can never be held twice, and it prints the `WT_*` namespace the run
96
- inherits. Two things follow, and both are the orchestrator's to carry:
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:
97
115
  - **Every step from here on works in `WT_PATH`,** and every delegated brief
98
116
  names that absolute path. The main checkout is read-only for the rest of the
99
117
  run — config, listing, nothing else.
@@ -112,7 +130,9 @@ Report `head` and the checkout you are in, and carry on. Do **not** re-cut becau
112
130
  a second phase, a resumed run, or `sassy-lfg` after `sassy-work` is already standing on
113
131
  the branch the first one cut. That is the whole reason this is inferred rather
114
132
  than forced. It is also what keeps a run inside its own worktree: it finds itself
115
- 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.
116
136
 
117
137
  ### `commit-here`
118
138
 
@@ -120,8 +140,11 @@ Only reachable with `policy: current`, which is an explicit statement that
120
140
  committing on the base branch is intended. Proceed, and say in the run's gate
121
141
  summary that the commits are landing on `<head>`. When the config says
122
142
  `commit.branch: current`, the close-out commits and pushes `<head>` to its upstream with **no PR** — no
123
- `sassy-commit-push-pr`, no `hooks.pr.*`, no babysit, no merge; only `hooks.push.after_push` runs. `pr-base` is
124
- 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.
125
148
 
126
149
  ### `stop-and-ask`
127
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
@@ -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 *offer* its own checkout; it asks, and the run stays in this one unless you say yes. 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
 
@@ -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
 
@@ -410,10 +466,11 @@ Three keys, no commands. The scripts in `.sassywares/worktree/` own the
410
466
  mechanics and `sassy-worktree` orchestrates them.
411
467
 
412
468
  **`enabled: true` is permission, not a default.** It makes a checkout available;
413
- `branching.md` still asks before a run takes one, and the run works in the main
414
- checkout until the answer is yes. Two runs only collide when they are actually
415
- parallel, and an unasked checkout relocates the work, leaves the uncommitted tree
416
- behind, and pays the setup hooks for a checkout nobody needed.
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.
417
474
 
418
475
  **A port is a resource, not the model.** Delete `ports` for an app whose preview
419
476
  is not a URL: no port is derived, `WT_PORT` and `WT_BASE_URL` are absent, and
@@ -479,8 +536,9 @@ report layout, the verdict classes, and the lint are in
479
536
  - `git.remote` is required when `git.repo: workspace`; forbidden otherwise.
480
537
  `git.mirror_branch` and `repos` are workspace-only too.
481
538
  - `hooks` is allowed only with the four points under `hooks.pr`, `after_push`
482
- under `hooks.push`, and `after_create`/`before_remove` under `hooks.worktree`,
483
- 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`.
484
542
  - `worktrees.enabled` is `true` or `false`; when `worktrees.ports` is present it
485
543
  is `<from>-<to>` inside 1–65535 with `<from>` no greater than `<to>`. A checkout must resolve
486
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 *offer* a checkout and takes one only on your yes, 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 the user — a run only asks.
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.
@@ -14,11 +14,13 @@ Read this when the project has `worktrees.enabled: true`, when a run is about to
14
14
  cut a branch, or when the user asks to run two agents in one project.
15
15
 
16
16
  **`enabled: true` is permission, not a default.** A run asks before it takes a
17
- checkout and stays in the main one otherwise: two runs only collide when they are
18
- actually parallel, and one taken unasked moves the work to another directory,
19
- leaves the uncommitted tree behind, and spends the `after_create` setup on a
20
- checkout nobody needed. `branching.md` owns that ask. `sassy-worktree` runs after
21
- the answer is yes, or when a human asks for a checkout outright.
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.
22
24
 
23
25
  ## Install
24
26
 
@@ -128,7 +130,7 @@ that names no port at all (a simulator, a desktop window) has nothing to probe,
128
130
 
129
131
  ## Hooks
130
132
 
131
- Two points, keyed by head branch like every other hook:
133
+ Two points, keyed by head branch like the PR hooks:
132
134
 
133
135
  ```yaml
134
136
  hooks:
@@ -201,6 +203,9 @@ implied.
201
203
  not nest another worktree.
202
204
  - **Enabled is permission, not a default.** A run offers a checkout and takes one
203
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.
204
209
  - **Never operate on another worktree.** A delegation brief carries the absolute
205
210
  path of the checkout it may touch; `MAIN` is for reading config and listing.
206
211
  - **Never `git stash`.** It is repository-global: a stash taken in one worktree
@@ -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.
@@ -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: []
@@ -5,7 +5,7 @@ description: >-
5
5
  commit it (or close out via sassy-ship if it was the last). The next phase is
6
6
  a run of its own when the user starts one. Also runs one settled in-context
7
7
  brief and stops before ship. The orchestrator only coordinates.
8
- argument-hint: "<plan path | brief> [phase:<n>] [branch:infer|current|new]"
8
+ argument-hint: "<plan path | brief> [phase:<n>] [branch:infer|current|new] [worktree:on|off]"
9
9
  ---
10
10
 
11
11
  # Sassy Work
@@ -16,7 +16,7 @@ argument-hint: "<plan path | brief> [phase:<n>] [branch:infer|current|new]"
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,13 +50,13 @@ 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 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.
@@ -77,7 +77,7 @@ Always gate before committing. The cycle has already fixed and verified its find
77
77
 
78
78
  When the argument is not a plan path, it is one settled brief:
79
79
 
80
- 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.
81
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.
82
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.
83
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.
@@ -89,6 +89,7 @@ When the argument is not a plan path, it is one settled brief:
89
89
  |------|-------------|
90
90
  | Orchestrator only | Delegate all implementation and quality work to `sassy-cycle`. |
91
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. |
92
93
  | One phase per run | Do exactly one phase. Never continue into the next phase in this session. |
93
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. |
94
95
  | Commit per phase | Commit the phase, its QA results, and the plan update via `sassy-commit` before close-out. |