---
description: Run a task end to end as one human-gated pipeline with a recorded stage and a live todo list — assess once whether it splits into aspects of the task, brief, the business context only I hold, the interface the change exposes, a short plan, implement and test, read the implemented change back as an HMML delta derived from the diff, comment pass, code quality standards, my review, PR, journal
argument-hint: '[<description> | --issue | --notes] [<phase> | queue [<aspect>...]] [--no-hmml] [--no-context] [--no-split] [--resume-deep]'
allowed-tools: Skill, Read, Write, Edit, AskUserQuestion, Bash(hobby-struct-parser:*), Bash(pwd:*), Bash(date:*), Bash(ls:*), Bash(rg:*), Bash(git branch:*), Bash(git -C * status:*), Bash(git -C * diff:*), Bash(git -C * log:*), Bash(git -C * rev-parse:*), Bash(git -C * ls-files:*), Bash(git -C * merge-base:*), Bash(git status:*), Bash(git diff:*), Bash(git log:*), Bash(git merge-base:*), Bash(git add:*), Bash(git commit:*), Bash(git push:*), Bash(gh pr list:*), Bash(gh pr view:*), Bash(gh pr create:*), Bash(gh repo view:*), Bash(jaq:*), Bash(gh pr checks:*), Bash(gh pr merge:*), Bash(gh run list:*), Bash(gh run view:*), Bash(gh run rerun:*), Bash(nu -c:*), Bash(cargo:*), Bash(just:*)
---

Run a task **end to end** as one predictable, human-gated pipeline. The individual
skills already exist (`journal:resume`, `hmml-extract`, `comment-pass`,
`structure`, `journal:write`); this is
the **thin orchestrator** that runs them in a fixed order, stops hard where I take over, and resumes in a
later session exactly where it left off.

**You are glue, not a reimplementation.** Never re-do what a sub-skill owns (HMML
grammar, how a delta is derived from a diff). Invoke it and trust its contract. Keep the sequential spine in *this* main-loop context so each
phase reuses the last one's understanding — do not fan work out to subagents
except where a sub-skill already does (`journal:resume`).

**Only facts and the interface are settled before code**: what the task is,
the business context only I hold, and the interface the change exposes to
other code and tools. The rest of the design is not reviewed up front. Once the change is
implemented and tested, it is read back as an HMML delta derived from the diff —
the HMML exists for me to understand what the code change is doing, so it
represents the implemented change, never a plan.

## Four rules that override everything else

1. **Hard-stop at every human gate** — GATE S (the split assessment, once per
   task), GATE C (the business-context questions, then the interface round,
   before anything is designed),
   and GATE 2 (once the change is implemented, tested, read back as a delta and
   comment-passed). "Hard stop" means: finish the
   phase, set `waiting_on`, write the state file, print a compact summary of what I need to do, and
   **end your turn**. Do not start the next phase, do not touch code, **do not
   create a worktree**, until I say so. **Reading the
   code is mine.** Nothing in this pipeline reviews the diff — the derived delta
   is for me to read, `/comment-pass` looks at the comments and `/structure`
   counts, and that is deliberately all of it. Do not add a review pass of your
   own, and do not print a critique of your own change at GATE 2; give me the
   diff, the delta and the evidence.
2. **Commit the task branch only, and only after GATE 2.** On my `continue` at
   GATE 2 the `pr` phase commits the change to this task's branch, pushes it and
   opens the PR; a CI repair in `ci` commits and pushes the same way. Nothing is
   committed before GATE 2, and **the notes repo is never committed** — the
   state file, the `.hmml` delta, `business-context.md`, the journal: I run
   `hwt sync` for that. Nothing is ever pushed to the default branch; every
   change reaches it through a PR, unless I say otherwise in chat. Commit
   messages follow the rule in `~/.claude-hobby/CLAUDE.md` — terse, a record of
   the decisions, and **no justification you were not given**. If a decision in
   the diff has no justification from my prompts or from what we settled, ask
   rather than inventing one.
3. **Never write a reason I did not give you.** The commit-message and PR rules
   in `~/.claude-hobby/CLAUDE.md` allow exactly three sources for a
   justification: my prompts, what we settled in discussion, or a fact you
   verified in the code. GATE C is where the first two get written down,
   verbatim, in `business-context.md`. A commit that needs a *why* none of them
   supplies is **asked about at GATE 2**, never filled in.
4. **No machine attribution** in anything you write — no `Co-Authored-By:
   Claude`, no `Claude-Session:` trailer, no `Generated with Claude Code` footer,
   no 🤖. It is advertising and these repos do not carry it. Comments, commit
   messages, PR descriptions and issue text have rules in
   `~/.claude-hobby/CLAUDE.md`, and you follow them.

## Step 0 — Resolve context, brief and phase

1. **Task context** from the worktree path (`pwd`), which is
   `~/fun_worktrees/PROJECT/TOPIC/TASK`: first dir project, second topic, third
   the task ID, verbatim, blurb suffix and all. There is no repo level — the task
   dir is the worktree. Fall back to `git branch --show-current`, skipping
   `master`/`main`/`develop`.

   **A code aspect** runs this pipeline too, from its worktree
   `~/fun_aspects/PROJECT/TOPIC/TASK/NAME` (started there by `/task:aspect`).
   Then the task is TASK and the aspect is NAME, and for the whole run:
   - **the notes dir** is `notes/PROJECT/TOPIC/TASK/aspects/NAME/` — the state
     file, the plan, the journal and the `.hmml` delta go there, wherever this
     skill says `notes/{project}/{topic}/{task}/`;
   - `business-context.md` stays the **task's** — one per task, read and
     appended to at `notes/PROJECT/TOPIC/TASK/`;
   - the brief is the aspect's `brief.md`, with the task's `issue.md` as its
     context;
   - **the base** is `aspect.json` `base`, else the default branch — every
     place below that says the default branch means the base, and the PR
     targets it;
   - `is_aspect: true` in the state file, which skips `assess-split`.

2. **The brief**, from the first argument:

   | argument | brief |
   |---|---|
   | free text | the text itself, recorded verbatim |
   | `--issue` | the task's `issue.md` — title, body, acceptance criteria, progress |
   | `--notes`, or nothing | `journal:resume` over the task's notes dir |
   | nothing, in an aspect | the aspect's `brief.md` |

   With no argument and an `issue.md` in the task's notes dir, do both:
   `journal:resume` **and** the issue. Record `brief_source` and the brief itself in the state file, and
   summarize the goal and next step in 2–4 lines. That framing carries through
   every later phase.

3. **State file** at
   `~/fun_repos/hobby-mimisbrunnr/notes/{project}/{topic}/{task}/build-task.json`:

   ```json
   { "phase": "assess-split", "brief_source": "issue|description|notes",
     "brief": "<the brief>", "plan": "<plan file name>",
     "hmml_delta": "<delta-<branch>.hmml path>",
     "no_hmml": false, "no_context": false, "no_split": false,
     "is_aspect": false,
     "split": { "assessed": "<YYYY-MM-DD>", "outcome": "none|split",
                "reason": "<one line>" },
     "prior_art": "",
     "context_rounds": [ [ "<question>" ] ], "context_recorded": null,
     "interface": { "form": "surface|decisions|none",
                    "agreed": [ "<signature line>" ],
                    "deviations": [ { "item": "<signature line>",
                                      "change": "<what changed>",
                                      "reason": "<what in implement forced it>" } ] },
     "evidence": [ "<command run, and what it showed>" ],
     "commits": [ { "subject": "<subject>", "body": "<body>" } ],
     "pr": { "title": "<title>", "body": "<body>" },
     "todo": [ { "text": "<step>", "status": "pending" } ],
     "waiting_on": null,
     "ci_rounds": 0,
     "written": "<RFC 3339>", "phase_since": "<RFC 3339>" }
   ```

   `phase` is one of `assess-split`, `plan`, `context`, `implement`, `delta`,
   `comments`, `standards`, `review`, `await-review`, `pr`, `ci`, `journal`,
   `handed-off` (this task's work lives in its aspects), `await-turn` (an
   aspect planned and waiting for its place in the queue), `done`. The task's
   aspect queue keeps its own state in `queue.json` (**Phase `queue`**) and
   never moves the task's `phase`. `context` is the waiting state GATE C
   leaves: the pipeline has asked me something and stops until I answer.
   Every write sets `written` to that write's time; `phase_since` moves with it
   only when the write also changes `phase`, and otherwise keeps its old value.

   **`is_aspect`** marks a run in an aspect's worktree. It is set from the path
   at Step 0, never inferred from anything else, and it permanently skips
   `assess-split` — an aspect does not split. **`split`** records the one-time
   assessment so it is never re-asked; it is absent until `assess-split` runs.
   What a split produced is recorded under this task's `aspects/`, written by
   `hwt aspect new`, and by the tasks it filed, and nowhere else.
   **`evidence`**, **`commits`** and **`pr`** are written in `implement` and
   `review`, and are what `pr` commits and opens. **`interface`** is the
   surface settled in GATE C's interface round and what implement changed of
   it; absent until that round runs, `form: none` when the change touches no
   interface in scope.

   **Migrate an old record** before anything else, and say so in one line: a
   phase of `await-hmml-review` or `revise` becomes `implement` (its annotated
   `.hmml` and review plan stay in the notes dir as notes; nothing is
   re-reviewed), `hmml_unit` and `hmml_units` become `hmml_delta` (empty until
   `delta` runs again; the old per-unit `.hmml` specs stay as notes), and
   `rounds` is dropped. A
   leftover `dev-flow.json` in the same directory is read once for its `phase`,
   then ignored — never written to again. A state file with no
   `split` record and a phase past `plan` gets
   `split: {"outcome": "none", "reason": "task already in flight"}` rather
   than a back-filled assessment: work found once a task is under way is added
   with `/aspect`. An `is_subtask` key from an older record is dropped, its
   task treated as having `split` recorded; a `subtasks` key is dropped too,
   and a `subtasks.json` is no longer read. A record an unattended run left —
   an `auto` key, or a phase not listed above — has `auto`, `merge`,
   `front_load`, `answered`, `replan`, `model` and `acceptance_result`
   dropped, and its phase is inferred from the artifacts as in step 4. A
   `queue.json` whose aspects carry a status not in **Phase `queue`** is
   reported and left alone.

4. **Starting phase**, in this precedence: a `queue.json` in the task's notes
   dir whose `phase` is not `done` outranks everything — the queue resumes
   where it stopped (**Phase `queue`**), and the task's own phase is taken up
   again once it is done. Then `phase: assess-split` outranks
   everything below — the split question is answered before any planning, and
   is skipped only when `is_aspect` is true, `no_split` is set, or `split` is
   already recorded. Else an explicit phase argument forces it — `queue`
   included, which queues this task's code aspects without touching `phase`;
   else `phase: await-turn` resumes as **Phase `await-turn`**; else `phase`
   from the state file; else **infer** from artifacts and say what you inferred
   — `business-context.md` has no section for this task and there is no
   `plan-*.md` → `plan`; a section but no plan file → `context`, resuming at the
   next-round derivation (my answers are on disk, the plan is not — a round
   may still be owed); uncommitted code changes
   or commits ahead of the default branch → `implement`; an open PR for the
   branch → `done`.

   **`phase: handed-off` is terminal.** This task's work lives in its aspects
   now. Run `hwt aspect list`, and print each aspect's state, live PR state and
   outcome, its `open_items` with no `issue`, and `hwt aspect start <name>`
   beside each still `open`. Then run `hwt done`: it refuses while an aspect is
   unfinished, which only means the task is still waiting, and it needs no
   confirmation from me because the aspects are the whole of this task. End the
   turn. Do not plan, implement, or open a PR here — this task owns no code.

   **The same applies whenever this session is asked.** A status question and a
   message from an aspect are both answered by running `hwt aspect list` again,
   never from what this session saw earlier. A message is a prompt to re-read
   the record, not a report to pass on. In any other phase, report what it says
   and carry on: `hwt done` is only this skill's to run when the task owns no
   code.

5. **Flags:** `--no-hmml` skips the `delta` phase, for a change I can read
   straight from the diff. `--no-context` skips GATE C's business rounds — for a
   change I have no domain background to give; its interface round still runs.
   `--no-split` skips `assess-split` for this task, for when I already know it
   is one thing. `--resume-deep` uses `journal:resume-deep`. Record each as its
   state-file flag so a resume does not silently re-add the phase. A
   `size_budget` or `context_gaps` key from an older record is dropped; a
   `context_questions` list becomes the single entry of `context_rounds`. A
   record past `context` with no `interface` is not sent back to ask one: it
   predates the round, and GATE 2 prints no deviations line for it.

6. **Rehydrate before running a phase that is not `plan`.** A resumed session has
   none of the understanding the earlier phases built, and does not need to guess
   — read, in this order: the state file's `brief`, `todo`, `evidence` and `interface`; the plan file; `business-context.md` — the domain facts I
   dictated at GATE C, in my own words, which are what the change was designed
   from and the only text a commit message may take an unverifiable *why* from;
   the derived `.hmml` delta when `delta` has run; and `git status --short` /
   `git diff`. Then say in two lines what the task is doing and where it stopped.

Announce the resolved `{project, topic, task, brief_source, phase}` in one line,
then run from that phase onward. Never redo an earlier phase. Write the
state file at **every** transition; do not `git add`/`commit` it.

## Live state

`hdash` shows `todo` and `waiting_on` on the task's card, so keep both current
while you work — they are how I see where a session is without opening it.

- **`todo` is the plan.** Seed it from the plan file's steps when the plan is
  written, one line each, every item `pending`. Items only change status —
  `active`, `done`, `dropped`; a step found on the way is inserted where it
  runs. Exactly one item is `active` while work is under way; flip it to `done`
  in the same write that starts the next one. Open items that outlive the task
  go to the journal at `journal`, never into `todo`.
- **`waiting_on`** is one line naming what I decide or do, set at every hard
  stop and when a sub-skill asks me something; `null` again in the write that
  starts the next step.

______________________________________________________________________

## Phase `assess-split` → GATE S (once per task)

The **first** phase of a new task, before any planning. Ask once whether this is
really one piece of work, or several that each want their own worktree, branch,
PR and tab. Then record the answer so it is never asked again.

Two homes for a piece that is cut off, and no third:

- **an aspect** — part of this task, worked in a tab of this task's session,
  started **now** or **later** in the task, but before it is done (`hwt done`
  refuses while one is unfinished). A code aspect is cut from the current tip
  of its base when started and delivers through its own PR to that base.
- **a task** — work planned for some later point that is not part of this
  task. It gets its own card through `/issue-create`, and no tab.

Skip the phase entirely — set `phase: plan` and continue — when `is_aspect` is
true, `no_split` is set, or `split` is already recorded.

**S1 — See whether the branch already holds work.**

```bash
git status --short
git log --oneline "origin/$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)..HEAD"
```

Commits are never moved between branches. A task whose branch already has
commits or a dirty tree is in flight: record
`split: {"outcome": "none", "reason": "task already in flight"}`, say so in one
line, and continue to `plan`. Work found later is added with `/aspect`.

**S2 — Read the whole task.** Step 0 already resolved the brief; if it came from
a bare description, also run `journal:resume` over the notes dir. This is the
only phase that sees the task before it is carved up, so read all of it.

**S3 — Draft the cut as deliverables, not as components.** Write the candidate
list as the order in which a player or a caller gains capability, *before*
looking at the code layout. Starting from the architecture is what produces
layer tasks, and shaping rule 1 exists to reject exactly those.

**S4 — Test every candidate against the five Task shaping rules** in
`~/.claude-hobby/CLAUDE.md`. That file is the standard and this skill
deliberately does not restate it. State each failure rather than silently fixing
it — a candidate that had to be re-cut is information about the shape of the
work, and I want to see it at the gate. The re-cuts that fix nearly everything:

- **Layer candidate → vertical slice.** "Add the component" becomes one narrow
  thing that is visible in the running game.
- **Carries an open question (rule 4) → make the decision its own item,** and
  make whatever depends on the answer wait. A question is not a deliverable —
  but one whose answer is a file is a research aspect.
- **Leaves state to be remembered (rule 5) → pull the cleanup into the same
  piece,** or make it an aspect that exists now.

Then give each survivor its home: an aspect (code or research; now or later)
when it is part of this task, a task when it is not.

**S5 — Check the set, not just the items.** Two properties the list as a whole
must have, both printed at the gate. Overlapping *files* are allowed — each
aspect has its own worktree and conflicts are resolved at PR time — but say
which files two pieces share.

- **Every piece stands alone** — if backing one out forces another out, they
  are one piece cut on the wrong axis (rule 3).
- **Nothing is left to remember** (rule 5) once every piece has merged — no
  flag, no dual path, no half-done migration.

**S6 — Decide whether to split at all.** Fewer than two surviving candidates
means this is one task: record `split: {"outcome": "none"}`, say so in one line,
set `phase: plan`, and continue into the normal pipeline. **This is the expected
answer for most tasks** — do not manufacture a decomposition to justify the
phase.

**→ GATE S: HARD STOP.** Write the state file with `phase: assess-split` still
set, then print:

- the **end state** in one or two sentences: what is true once every piece has
  landed;
- a table of proposed pieces — name, aspect (`code`/`research`, `now`/`later`,
  base when not the default branch) or task, the queue position of every code
  aspect worked now (they run one after another, in this order), the user-visible behaviour, the
  done-when observation (rule 2), the files it owns, and any `enabling` label
  with the piece it unlocks;
- the **rejected candidates**, with the rule each failed and how it was re-cut;
- the two set-level checks from S5, each `pass` or the specific pair that
  fails;
- the exact commands the approval will run, one line each, so I can see the
  blast radius before it happens;
- *"Edit, merge or drop any piece, then say continue and I'll create them. Say
  `no split` and I'll carry on as one task."*

End your turn. **Create no worktree, file no issue.**

______________________________________________________________________

## Phase `handed-off` — on my go at GATE S

Only after I approve the decomposition. Per approved aspect, in order:

1. **Add it** — the decisions were made at the gate, so run the primitive
   rather than the interactive `/aspect`:
   ```
   nu -c "use ~/.config/nushell/hwt.nu *; hwt aspect new <name> --kind <kind> --goal '<one line>' [--base <branch>]"
   ```
   Then overwrite its `aspects/<name>/brief.md` in the shape `/aspect` step 6
   gives — goal, done when, why the task needs it, already known, where to
   look, out of scope — read by a session that has no memory of this
   conversation.

Per approved task: run `/issue-create` for it, naming this task in its context.
One that waits on an aspect gets a block, not a sentence in its body:
`nu -c "use ~/.config/nushell/hwt.nu *; hwt block --reason 'waits on aspect <name> of <this task>' --task <t> --project <p>"`,
and `<p>/<t>` in that aspect's `blocks` list in `aspect.json`, so the aspect can
hand it on.

Then, once per task:

2. Set `split: {"outcome": "split", …}` and `phase: handed-off`, and write the
   state file. The aspects themselves are already recorded: `hwt aspect new`
   wrote each one under `aspects/`.
3. Run `journal:write` once, recording the decomposition and *why* each cut fell
   where it did. The rejected candidates belong here too — that reasoning is the
   part that would otherwise be lost, and the aspects' journals will not have it.
   Aspect status is not journal content: `## Current State` says to read
   `hwt aspect list`, so it cannot go stale.
4. With any code aspect worked now, write `queue.json` first (**Phase
   `queue`**): those aspects in the gate's order, the first `running` and the
   rest `waiting`. Then start every aspect worked now, research and code:
   `nu -c "use ~/.config/nushell/hwt.nu *; hwt aspect start <name>"` for each —
   it checks the aspect out from its base's current tip and opens its tab. A
   rebase conflict is aborted and reported; stop there and tell me. Print the
   handoff: each aspect with its kind, its place in the queue, and whether its
   tab is open or it waits as `open` (`hwt aspect start <name>`, or a click in
   hdash, starts it later), each task filed, a note that `hdash` lists the
   aspects on this task's card, and that every code tab asks its questions now
   and implements in turn.

**Only the aspects worked now are started here.** **This task implements
nothing** — it owns no code and opens no PR. A research aspect messages this
session when it finishes (`/task:aspect` step 7). With no code aspect worked
now, end your turn; otherwise go on to **Phase `queue`**.

______________________________________________________________________

## Phase `queue` — every code aspect asks first, then implements in turn

What it is for: every queued code aspect asks its questions and plans as soon
as its tab opens, then waits; each one implements only once the one before it
has merged, so it builds on a base that already holds it (`business-context.md`
of `hobby-tooling/llm_workflow/drop_auto_mode`, `## intent`,
`## questions-first`). Every aspect runs the whole of this pipeline in its tab,
GATE C and GATE 2 included. Entered from `handed-off`, or by the `queue`
argument over aspects added with `/aspect`: `queue <name>...` in that order,
else every code aspect still `open`, by `created` — written to `queue.json` as
in `handed-off` step 4, then each started with `hwt aspect start <name>`. A
research aspect is never queued.

**State** is `queue.json` in the task's notes dir, written at every change:

```json
{ "phase": "run|done",
  "aspects": [ { "name": "", "status": "waiting|running|done", "pr": "" } ],
  "written": "<RFC 3339>" }
```

Only this session moves an aspect to `running`; an aspect only reads it
(**Phase `await-turn`**).

**The driver**, in this session (`## queue-driver`). For the aspect that is
`running`:

1. **Wait** for its `aspect.json` `state` to be `done` — `/task:aspect finish`
   sets it once its PR has merged — with a background Bash call
   (`run_in_background: true`):
   `until jaq -e '.state == "done" or .state == "closed"' <aspect notes dir>/aspect.json >/dev/null; do sleep 30; done`.
   End the turn; its exit resumes this session. A resumed session with
   `queue.json` `phase: run` starts the same wait again. Never read the
   aspect's code, plan or diff.
2. **On its exit**: `status: done` and `pr` from `aspect.json`. Set the next
   `waiting` aspect `running` and write `queue.json` before anything else, so
   a tab restarted from here on picks its turn up by itself.
3. **Tell it.** Find its session with `ListAgents` — an aspect's session name
   starts with its worktree's basename, the aspect's name, non-alphanumerics
   as `-` — and `SendMessage` it: `your turn in the <task> aspect queue: rebase
   and implement (/task:build, phase await-turn)`. No such peer listed →
   set `waiting_on` to `start aspect <name> in its tab`, print that one line,
   and go back to 1 for it: the tab picks up its turn whenever it next runs.
4. Back to 1.

A message from an aspect while the queue runs is not a step: it is the
`/task:aspect finish` notice, and the wait already sees the same state.

**When every aspect is `done`**: `queue.json` `phase: done`, clear
`waiting_on`, print one line per aspect with its PR, then go on as the task's
`phase` says — `handed-off` re-reads `hwt aspect list` and runs `hwt done`.

## Phase `await-turn` — an aspect waiting for its place in the queue

**In an aspect** whose task's `queue.json` lists it, the plan step of
**Phase `context`** ends here instead of in `implement` when its status is
not `running`: record `planned_at` (`git rev-parse HEAD`), set `phase:
await-turn` and `waiting_on` to `waiting for <the aspect before it>`, print
that one line, and end the turn. An aspect already `running` when its plan is
written records `planned_at` and carries straight on to `implement`.

Resumed — by the task session's message, a restarted tab, or me — read
`queue.json` again. Not `running` → print the same line and end the turn.
`running`:

1. `nu -c "use ~/.config/nushell/hwt.nu *; hwt aspect start <name> --no-tab --rebase"`
   — onto the base's current tip, which now holds every aspect before it. A
   conflict is aborted; print it, set `waiting_on`, and stop.
2. **Replan when the base moved** — `HEAD` differs from `planned_at`
   (`## stale-plan`). Read what landed (`git log --stat <planned_at>..HEAD`),
   take the recorded answers in `business-context.md` as if given now, and
   write a new dated plan file — the earlier one stays. Print what changed
   against the earlier plan, one line per step added, dropped or changed, and
   record the same list in the new plan's Open Questions. Reseed `todo`, and
   update `plan` and `planned_at`. Nothing moved → say so in one line.
3. Clear `waiting_on`, set `phase: implement`, and carry on.

______________________________________________________________________

## Phase `plan` → GATE C

**Gate 0 — prior art.** Before any code. No sweeping changes without prior
discussion, and do not accelerate past someone else's active work.

- `gh pr list --search "<keywords>" --state all` on the repo this task targets,
  and `rg -il "<keywords>" ~/fun_repos/hobby-mimisbrunnr/notes/<project>/*/*/issue.md`
  for the issues in the notes. Report anything overlapping, with its state.
- **Stop and ask** if an open PR or active issue covers this work.

Record `prior_art`. On my own repo this is usually one empty
search; on a repo I do not own it is the difference between a welcome PR and a
closed one.

**Gate 0b — the standards this repo holds.** If the target repo has a
`structure.hstruct` (at its root, or at the crate root in a workspace), read it
and run `hobby-struct-parser <repo>` for the current numbers. State in one line
each:

- the standards, and which the planned change is likely to move, in which
  direction;
- any reviewed (`review:`) standard whose subject the change touches.

This is the cheap end of the loop. "This adds a module importing eight others and
the standard says six" is a design choice at plan time and rework at review time.
Carry the reading into the plan file.

A repo with no `structure.hstruct` skips this silently — most have none, and a
task is not the place to argue for one.

**Read the code the change will touch.** Enough to know what it does today —
the units, the data, the call paths the brief lands in. No spec is written here:
the delta is derived from the diff once the change exists, and that is where the
baseline comes from.

**Ask for the business context.** The change is not designed yet. This is the
moment to collect what only I have — the context the change has to be designed
inside: which rule sets a bound, what an upstream system guarantees, what a
later reader will break by tidying a shape away, why the obvious approach was
rejected before. Ask now and the answers shape the plan, the code *and* the commit
message. Ask after the code exists and they can only decorate
it.

Skip this step entirely on `--no-context`: set `phase: context` and carry on to
**the interface round** in the same turn — `--no-context` skips the business
rounds only.

First **read what is already written down**: the brief, the task's `issue.md`,
and the task notes. Ask for nothing recoverable from those — quote it instead.

Then derive what building this needs to know that the current code cannot tell
you: the goal read against the code. **Do not ask it all at once.** The answers
build on each other — one answer settles a second question, reshapes a third,
or comes back as a question of its own — so GATE C is a conversation of small
**rounds**, each of one to three questions on one theme.

**Before anything is asked, drop what is not mine to answer.** A question that
research, the code or an earlier task's notes could settle — how a dependency
behaves, whether there is a standard, what a sibling task decided — is looked
up, not asked; the finding goes in that question's `what I found:` line, or
makes the question unnecessary.

**Order the rounds by dependency.** The first round holds the questions whose
answers decide whether other questions exist at all: the scope, the one
decision the rest hang off, and — when neither `issue.md` nor the brief states
it — the **done-when**: *what should you be able to do, and see, to call this
done?* (`~/.claude-hobby/CLAUDE.md`, Task shaping rule 2). Detail comes in later
rounds, derived from what the earlier ones said.

Each question is

- anchored to something named — a file, a unit, a field, a rule in the brief;
- about the **system**: what produces this, what consumes it, which rule forces
  it, what goes wrong without it;
- one question, never two joined by *and* — an answer to a compound question
  says *"for the first one"* and leaves the second hanging;
- carrying the one line you found while looking (`what I found: …`), or an
  explicit blank (`nothing in the notes or the issue covers this`).

Two kinds, asked differently:

- **A fact only I hold** — a rule, a target, what an upstream guarantees, why
  something was rejected before — is asked **open**, with no draft answer and no
  leading guess. A proposed sentence with a question mark gets rubber-stamped,
  and then the reasoning is yours, not mine.
- **A choice between shapes** is asked as **lettered options**, each with what
  it costs, plus *"or another shape"*. An open *"what constrains X?"* over a
  design choice gets a blank or a guess; options with their costs get a
  decision.

**Nothing worth asking?** Say so in one line (`the brief is self-contained — no
business context needed`), set `phase: context`, and carry straight on to
**the interface round** **without** stopping. A gate with nothing behind it is
friction.

**→ GATE C: HARD STOP, once per round.** Otherwise set `phase: context`, append
the round's questions verbatim to `context_rounds` as a new last entry (so a
resumed session re-asks *these* rather than inventing new ones), set
`waiting_on` to `answer GATE C round <n>`, write the state file, then print the
round's theme in a few words, its numbered questions, and one line: *"Answer in
your own words — `N: skip` if there is nothing to say, and a skip is a real
answer. Say `plan` to stop asking and plan from what is recorded."* End your
turn.

______________________________________________________________________

## Phase `context` → `implement`

The waiting state written at GATE C. Entered when my answers to a round come
back.

**The `context` phase argument re-opens it at any point** — the pipeline's one
loop, and how more of what I know gets in after I have seen something. Invoked
later, it derives its questions from whatever prompted the top-up (usually the
delta I just read at GATE 2, at a `file:line` you can now show me), appends the
answers to the same section, and returns to `implement`.

**Record my answers, verbatim.** Append them to
`~/fun_repos/hobby-mimisbrunnr/notes/{project}/{topic}/{task}/business-context.md`
(create it with the notes front matter — `title: "{task} — business context"`,
today's `created`, tag `context`), one `## <short handle>` block per answer:

```markdown
## wave-cap
Q: why cap concurrent spawners rather than queueing the overflow?
The spawn budget is what keeps the frame time under the 16ms target on the
Steam Deck; a queue would hide the cap and stutter instead of dropping a wave.
```

**Copy my wording. Never paraphrase, summarize, complete or tidy it.** This file
is the only text a commit message may take an unverifiable *why* from, so a
sentence you smoothed here becomes a claim I never made. Record a skip too — the
handle with the body `skipped — no context to give`. A question I leave
unanswered is a skip: record it as one rather than asking again. A follow-up
that a later round asks about an earlier answer gets a handle of its own; the
earlier block is never edited.

**Then derive the next round from what is now recorded.** Read every question
still in mind against the answers so far:

- **settled** by an answer → dropped, without asking;
- **reshaped** by one → asked in its new form;
- the answer **asks back** (*"what do you mean by …?"*, *"what would supporting
  both cost?"*) → the next round opens with your answer to it, then the
  question again in the sharpened form;
- the answer **hands it to you** (*"I don't know, check how bevy loads them"*)
  → go and look now; the next round opens with what you found, and asks
  again only if what was found still leaves a choice that is mine;
- the answer is **ambiguous** between two readings → ask which, quoting it.
  An ambiguity left for GATE 2 becomes a default of yours I can only accept or
  reject after it is built.

Something left that the code, the notes and research cannot settle → the next
round, through **GATE C** again (`context_rounds` grows by one entry). Nothing
left, or I said `plan` → on to **the interface round** in the same turn. There
is no cap on the number of rounds: the loop ends when nothing unrecoverable is
left, and a round with nothing behind it is not asked.

**The interface round** is the last round of GATE C, after the business rounds
and before the plan (`hobby-tooling/llm_workflow/more_implementation_steering`,
`## where-interface`). It puts the interface choices to me while they are still
free. Made in `implement`, each one is small and defensible on its own, and at
GATE 2 there are too many to correct (`## why-gave-up`).

*In scope* (`## interface-scope`): the `pub` items of a library crate; an API
between modules or crates — the functions, types and traits one of them calls
on another; a format another tool reads — a file like `task.json`, a CLI
subcommand or flag, a socket command, an environment variable. A binary's
internals are not in scope.

Draft the surface the change will need: every in-scope item it adds, changes or
removes, from the code read in `plan` and the answers recorded so far. None →
record `interface: {"form": "none"}`, say so in one line, and go on to the plan.

Otherwise pick the **form** by this rule, and name it at the top of the round
with *"say `switch` for the other form"* (`## interface-form`,
`## interface-form-choice`):

- **`surface`** — the change creates a crate, a module or a format, or
  reshapes an existing public surface (renames, removes, or changes a
  signature). One round per module, crate or format: every item is one
  numbered line in the language's own syntax, marked `+` added, `-` removed,
  `~` changed as `old → new` —
  `3 + pub fn chunk_at(&self, world: Vec2) -> Option<(ChunkCoord, UVec2)>` —
  and under an item where there is a real choice, lettered options with what
  each costs.
- **`decisions`** — the change only adds to a surface that keeps its shape.
  Only the points where there is a choice, each as lettered options with what
  it costs, in one round; the items without a choice are not shown.

I answer by number; an item I do not mention stands as shown, and `plan` here
accepts the rest of the surface as shown. Record my answers verbatim like any
round's, under `## interface-<module>` handles, and the surface with my answers
applied, one line per item, in `interface.agreed`, with the form in
`interface.form`. An answer that reshapes items is derived like any other
(above): another round for that module, showing only what my answer left open.
Each round is a **GATE C** stop: its questions go into `context_rounds`, and
`waiting_on` reads `answer GATE C interface round <module>`.

Once the surface is agreed, write `context_recorded` (today's date), clear
`waiting_on`, and carry on in the same turn.

**Write a short plan.** One file,
`~/fun_repos/hobby-mimisbrunnr/notes/{project}/{topic}/{task}/plan-{YYYY-MM-DD}-{slug}.md`,
in the plan format of `~/.claude-hobby/CLAUDE.md` — Goal, Approach, Steps, Key
Files, Open Questions — and short: the steps are the order you will work in,
one line each, naming files. A recorded answer the change has to honour is
cited in the step it shapes by its `business-context.md` handle, so it is not
carried in your head to be remembered at the commit; a step that builds an
agreed interface item names it. A new dated file per
planning session; never overwrite an earlier one. Record its name as `plan` and
seed `todo` from its steps (**Live state**). The plan is not a gate: say in one
line where it is, set `phase: implement`, and carry on — **in an aspect in its
task's queue**, on to **Phase `await-turn`** instead.

______________________________________________________________________

## Phase `implement`

Entered from `context` in the same turn, or on a resume. Work from the plan
file and keep `todo` moving as you go. A design question only I can answer is
asked when it comes up, as one line with the options you see — set
`waiting_on`, stop, and resume at the same `todo` item. It is not saved for a
gate, and it is not answered on my behalf.

**The agreed interface is changed without stopping** (`## interface-deviation`).
An item of `interface.agreed` that does not survive the implementation, and an
in-scope item the interface round did not show, is changed or added as the
code needs — and recorded in `interface.deviations` in the same step, with
what changed and what in the implementation forced it. GATE 2 lists them.

Write comments to the rule as you go — a module header, and a public element's
comment only where it tells the caller something the signature does not. Write
for a reader who never saw this conversation. The `comments` phase is a check,
not a laundry: do not write comments expecting it to delete them.

**Test.** Drive it end to end: run the app or the affected flow, plus the repo's
own test command (`cargo test`, `cargo clippy`, `just test`, whatever it uses).
Then **run the repo's CI locally**: for every job in `.github/workflows/*.yml`
and `*.yaml` triggered by `pull_request` or `push`, its `run:` steps in order
from the worktree root, with the job's `env:` and each step's
`working-directory:`. A matrix runs once, on this machine's toolchain. Skip
`uses:` steps and any step that reads `secrets.` or needs a `services:`
container or another OS, and carry the skipped ones into GATE 2. A failing step
is fixed here like a failing test, so the diff I review is one CI is expected to
pass. No workflows → nothing to run.

Record the evidence under `evidence`, one line per command run, then fall
through to `delta` without stopping. **Commit nothing here.**

## Phase `delta`

Skip with `--no-hmml`, and for a diff with no behaviour change — docs, tests
only, config values, a mechanical rename — saying so in one line.

Run `/hmml-extract --against <ref>`, with `<ref>` the merge base of the
worktree and the default branch
(`git merge-base HEAD "origin/$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)"`).
Nothing is committed yet, so the delta's header says `head: worktree` and its
links point into the files on disk. It writes one `delta-<branch>.hmml` into
the notes dir: the touched units'
walks as the worktree leaves them, each changed step marked `+` / `-` / `~` and
linked to the diff, the data and signatures the change touches, and its tests
in summary, then lints it. Record its path as `hmml_delta`.

The delta is **derived, never maintained**: do not edit it, and rerun this phase
after any later change to the code's behaviour — a fix I ask for at GATE 2, a
CI repair. It is for me to read; it is not a review of the change and it does
not gate anything. Fall through to `comments`.

______________________________________________________________________

## Phase `comments`

Run `/comment-pass` over the branch diff. It deletes what the comment rule
disallows, cuts comments pitched at the wrong level or written for the
conversation, and writes missing module headers and the public comments a caller
needs.

Carry two parts of its report to GATE 2:

- the **shape-decision notes** it pulled out of deleted body comments — facts
  about why the code looks the way it does, whose home is the commit message;
- anything it **declined to act on** — a module with no single responsibility, a
  name that needs changing, a behaviour it could not verify. Each is a decision
  for me.

Then fall through to `standards`.

______________________________________________________________________

## Phase `standards`

Skip entirely if the target repo has no `structure.hstruct`.

Run `/structure` on the target repo. Three outcomes, and only one needs you to
do anything:

- **Unchanged** — nothing to report.
- **Slack** — the change improved a number. Run the ratchet; the tightened budget
  joins this task's diff, which is how an improvement gets recorded by the change
  that made it.
- **Exceeded** — the change moved the repo further from a standard it states.
  **Try to fix it**: read `--detail` to find what this change added, and repair
  it. A new cycle usually wants an event or a read-only query rather than an
  import; a file crossing the line usually wants the split its responsibility
  already implies. Re-run after the fix.

  **If the fix does not work, carry it to GATE 2 as a regression** — the standard,
  the count before and after, and what you tried. Do not route around it and do
  not raise the budget. Raising is a hand edit I make deliberately, because it
  says in the diff that this project got further from its own standard.

Then check the **reviewed** standards. A `review:` standard is only re-audited if
something asks, so read each one against this diff: if the change touches what it
covers, say so and ask whether to re-audit and bump `audited:`. Do not bump a date
for a standard the change did not touch, and do not treat an old date on an
unrelated standard as a finding.

Record the delta, then fall through to `review`.

______________________________________________________________________

## Phase `review` → GATE 2

**→ GATE 2: HARD STOP.** Set `phase: await-review`, set `waiting_on` to
`read the change at GATE 2`, write the state file.

GATE 2 is **layered**: it prints the overview, and I zoom in on request. The
overview is what I read every time, so keep it short enough to read in one go.

**The overview — printed:**

- **what changes**, in two or three sentences, for a person using the program,
  not in terms of files;
- **the derived delta**, at behaviour level — its path, then the file as it
  stands, with its count of `+` / `-` / `~` lines per section. It is the cheapest place to catch a change that does something the
  brief did not ask; show it, do not describe it. With no delta (skipped, or
  `--no-hmml`), say so in one line;
- **evidence** in one line — what was run and that it passed — plus any CI step
  skipped locally;
- **interface deviations** — every `interface.deviations` entry, one line
  each: the item, what changed, what forced it; `none` when there are none, and
  the line left out when `interface.form` is `none` or there is no `interface`;
- **what needs my decision**, and only that: a standards regression you could not
  fix (what you tried), anything `/comment-pass` declined, a commit that needs a
  justification no handle or verified fact gives. None → say `nothing to decide`;
- **the proposed commits** — subject and the files each takes; the full bodies
  are in the state file and shown on `messages`;
- **the proposed PR title**;
- *"Say `design` for the module and API level, `diff` for the files, `messages`
  for the full commit and PR text. Say continue to commit, push and open the PR,
  or tell me what to change."*

**On request — printed only when I ask:**

- `design` — the program's shape: per module touched, its header and every
  public signature added, changed or removed, with its comment, and whether it
  is as agreed in the interface round, a deviation, or out of its scope; how the modules
  now depend on each other where that changed; and the delta's `## api` and
  `## data` sections when `delta` extracted one. Then the standards delta,
  each budget before and after;
- `diff` — the files, one line each on what changed, then whatever part of the
  diff I name;
- `messages` — every proposed commit message in full and the PR body, to the
  rules (see `pr`), with the shape-decision notes and the `business-context.md`
  handles they cite.

After a zoom, end the turn again; the gate still holds.

Record the proposals as `commits` and `pr` in the state file, so a resumed
session opens exactly what I approved. A change I ask for here goes back
through `implement` and `delta` before the gate is printed again; an edit to a
message only rewrites the proposal. End your turn.

______________________________________________________________________

## Phase `pr` — on my go only

**The PR rule**, which the proposal at GATE 2 is written to: a title in the
commit-subject shape, then **What do we change** and **Why do we change** at one or
two sentences each, then **How can you test it by hand** as an ordered bullet list
whose last bullet says what I should see. No other sections, no `## AI use`, no
empty section, no attribution.

The *why* is sourced, not invented — from my prompts, from what we settled, or from
something you verified in the `implement` phase. If you do not have one, ask at
GATE 2 rather than proposing one.

The manual-test bullets come from what you actually ran in `implement`. If nothing
there was run by hand, say so in one bullet and name what does cover it.

On my `continue`, from the approved `commits` and `pr` in the state file:

1. Make each commit in order — `git add` its files, `git commit` with its
   message. The source repo only; the notes repo is never committed.
2. `git push -u origin HEAD` — the task branch, never the default branch.
3. `gh pr create --title '<title>' --body '<body>'` against the default branch.

The `track-pr` hook records the PR to `prs.json`. If it did not fire, append the
PR there yourself (create with `[]` first; never store the PR's live state).
**In an aspect** the hook does not fire and nothing goes to `prs.json`: open
the PR with `--base <the base>`, and set `aspect.json` `state` to `pr` and its
`pr` to the URL (Edit, keep every other key). Then, for each `<p>/<t>` in its
`blocks`: `nu -c "use ~/.config/nushell/hwt.nu *; hwt block --pr <url> --task <t> --project <p>"`.
Set `phase: ci` and continue.

**Every change reaches the default branch through a PR.** Push to the default
branch only when I say so in chat for this task, and then skip `ci` for
`journal`. An aspect's PR targets its base, and the aspect is done only once
that PR has merged.

## Phase `ci` — the PR is green before the pipeline ends

The local run in `implement` cannot reproduce `uses:` steps, secrets, service
containers or another OS, so the PR's own checks are the authority. Watch them
and repair them; never hand me a red PR as finished.

1. `gh pr checks <pr url> --watch --interval 30`, Bash `timeout: 600000`. At
   most four calls on a timeout; a fourth is step 4 with
   `checks still pending after ~40 minutes`. `no checks reported` while the
   repo has workflows is not green yet: `gh run list --commit <head sha> --json
   status` — a run listed means call 1 again; none listed means no workflow
   triggers on this PR, which counts as green.
2. **Green** → the merge (below), then `journal`.
3. **A check failed** → read it with `gh run view <run id> --log-failed`, and
   decide which of four it is:
   - **the diff's own** — repair it reading the files the log names, run the
     failing step locally, `/comment-pass` over what changed, commit to the
     message rule, push, and rerun `delta` when the repair changed behaviour.
     The repair is shown in the wrap-up, because it landed after GATE 2.
   - **the runner died** — cancelled, timed out, failed to start, or a
     network or shutdown error in the log: `gh run rerun --failed <run id>`
     only.
   - **the base is already red there** — the same check fails on the base's
     latest run (`gh run list --branch <base> --workflow <workflow> --limit 1
     --json conclusion`): step 4, `not mine`.
   - **a pinned revision needs re-pinning** — a dependency at a `rev` or
     version that no longer resolves: step 4, `decision`; re-pinning is a
     project decision, not a repair.

   A repair or a rerun increments `ci_rounds`, then back to 1. **Three is the
   bound**: with `ci_rounds` at 3, a fourth failure is step 4.
4. **Blocked** → print the PR, the case, the failing check and at most three
   log lines, set `waiting_on`, and **stop**: the next step is mine.

**The merge is mine**, unless I said in this session that this PR may merge
once its checks are green (`## self-merge-permission` of
`hobby-tooling/llm_workflow/drop_auto_mode`). Then, on green,
`gh pr merge <pr url> --merge` — never `--admin`, never a force — and record
it in `evidence`. A refusal is step 4.

## Phase `journal`

**In an aspect**, wait for the merge first, with a background Bash call
(`run_in_background: true`):
`until [ "$(gh pr view <pr url> --json state -q .state)" != OPEN ]; do sleep 30; done; gh pr view <pr url> --json state -q .state`.
Set `waiting_on` to `merge <pr url>` and end the turn; its exit resumes this
session, and a respawned tab starts the same wait. `MERGED` → clear
`waiting_on` and go on. `CLOSED` → print it and stop, `waiting_on` kept: the
next step is mine. An aspect's done-when was read at GATE 2, so the merge is
what is left.

Run `journal:write` — goal, what changed, evidence, open items.

**In an aspect**, run `/task:aspect finish`: it records the outcome and open items
in `aspect.json` and tells the task.

Set `phase: done`.
Print a one-line wrap-up: task, PR link if any, anything still open. End.

______________________________________________________________________

## Notes on scope

- If a sub-skill asks its own clarifying question, surface it — do not answer on
  my behalf. The pipeline asks for wording of its own in exactly one place,
  GATE C, and what I answer there is recorded verbatim: no phase and no
  sub-skill may smooth it into prose of yours.
- **This pipeline is one branch.** Work found on the way that is part of this
  task but outside this branch's change is an aspect — `/aspect`, now or later;
  work that is not part of this task is a task for later, `/issue-create`.
- If artifacts and the state file disagree, trust the artifacts, say so, and
  correct the state file.
- If I ask for something off-pipeline mid-run, handle it, then re-anchor on the
  current `phase`.
