@johngaynor/entourage 0.1.2 → 0.3.0

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/README.md CHANGED
@@ -16,6 +16,11 @@ They live in [skills/](skills/). `entourage install` links them into
16
16
  `~/.claude/skills`, so any Claude Code session on the machine can run one by
17
17
  name, such as `/sdlc-define ABC-122`.
18
18
 
19
+ Whenever a skill stops, it ends with a handoff block: which step it was, and
20
+ whether it is `done`, `needs-human` or `failed`. A `done` block also names the
21
+ step that comes next. Whoever is driving, you or `entourage task new`, reads
22
+ that block to know what happens next.
23
+
19
24
  ## Setting up a machine
20
25
 
21
26
  ```sh
@@ -64,6 +69,13 @@ every repo of the project, and opens a tab for it:
64
69
  entourage task start my-project feat/abc-122-insert-task-here
65
70
  ```
66
71
 
72
+ Name targets after the branch to take only what the task needs: a repo, or
73
+ groups inside a repo (`app:athlete`, or `app:athlete,coach` for several).
74
+
75
+ ```sh
76
+ entourage task start my-project feat/abc-122-insert-task-here app:athlete billing
77
+ ```
78
+
67
79
  The branch is `<type>/<description>`, following
68
80
  [Conventional Branch](https://conventionalbranch.org), with the card's ID in
69
81
  the description. The description names the task:
@@ -76,6 +88,10 @@ the description. The description names the task:
76
88
  web/ a worktree of web on the same branch
77
89
  ```
78
90
 
91
+ If a repo has a `justfile` with a `setup` recipe, `just setup` then runs in
92
+ the task's tab, so the checkout is ready to work in. See
93
+ [what a repo provides](herdr/README.md#what-a-repo-provides).
94
+
79
95
  See [herdr/README.md](herdr/README.md#tasks) for the details.
80
96
 
81
97
  To work on entourage itself, clone the repo and run `cli/entourage install`
package/cli/entourage CHANGED
@@ -17,9 +17,10 @@ Usage:
17
17
  entourage project new <name> make a project from the template
18
18
  entourage project add <name> <path> add a repo that is already on this machine
19
19
  entourage project open <name> show the project as a Herdr space
20
- entourage project ls list projects and their repos
20
+ entourage project ls [--json] list projects and their repos (--json for programs)
21
21
  entourage task new <project> <card> write a card up: an agent defines, plans and breaks it down
22
- entourage task start <project> <branch> start the work: a worktree per repo, opened as a tab
22
+ entourage task start <project> <branch> [<repo>[:<group>[,<group>...]] ...]
23
+ start the work: a worktree per repo, opened as a tab
23
24
  entourage help
24
25
 
25
26
  A project groups repos that belong together, with a PROJECT.md saying what
@@ -32,7 +33,11 @@ sdlc-define, sdlc-plan and sdlc-breakdown skills and asks you to approve it.
32
33
  `task start` takes a branch, <type>/<description>, like
33
34
  feat/abc-122-short-title (https://conventionalbranch.org). It makes a folder
34
35
  in the project's tasks/ folder with a worktree of each repo on that branch,
35
- and opens a tab for it.
36
+ and opens a tab for it. A repo with a justfile that has a `setup` recipe
37
+ gets `just setup` run in that tab, so the checkout is ready to work in.
38
+ Targets after the branch narrow the task: `app` takes only that repo, and
39
+ `app:athlete` sets it up for its athlete group (`just setup athlete`).
40
+ Join several groups with a comma: `app:athlete,coach`.
36
41
 
37
42
  Herdr's folder is ~/.config/herdr-app (HERDR_APP_HOME picks another).
38
43
  Skills are linked into ~/.claude/skills (CLAUDE_CONFIG_DIR picks another
@@ -74,7 +79,7 @@ TEMPLATE_MARK='<!-- entourage:template -->'
74
79
 
75
80
  # Sourced, so every file shares the settings above and each other's functions.
76
81
  LIB=$REPO/cli/lib
77
- for part in common links project task commands; do
82
+ for part in common links recipes project task commands; do
78
83
  [ -f "$LIB/$part.sh" ] ||
79
84
  { printf 'entourage: %s is missing; reinstall entourage\n' "$LIB/$part.sh" >&2; exit 1; }
80
85
  # shellcheck source=/dev/null
@@ -78,6 +78,10 @@ cmd_status() {
78
78
  say "Projects: $PROJECTS"
79
79
  local project_problems=0
80
80
  check_projects || project_problems=$?
81
+ # Only worth saying on a machine that has projects to start tasks in.
82
+ if ! have_just && [ -n "$(ls -d "$PROJECTS"/*/ 2>/dev/null)" ]; then
83
+ say " note just is not installed, so tasks start without setup. Install it: https://just.systems"
84
+ fi
81
85
  if [ "$problems" -gt 0 ] || [ "$project_problems" -gt 0 ]; then
82
86
  [ "$project_problems" = 0 ] || say "$project_problems project problem(s)."
83
87
  return 1
package/cli/lib/common.sh CHANGED
@@ -15,6 +15,20 @@ herdr_app() {
15
15
 
16
16
  have_herdr() { command -v herdr-app >/dev/null 2>&1 || [ -x "$BIN_DIR/herdr-app" ]; }
17
17
 
18
+ # hc is the command for Herdr's terminals; it is installed beside herdr-app.
19
+ hc_cmd() {
20
+ if command -v hc >/dev/null 2>&1; then hc "$@"
21
+ elif [ -x "$BIN_DIR/hc" ]; then "$BIN_DIR/hc" "$@"
22
+ else return 127
23
+ fi
24
+ }
25
+
26
+ have_hc() { command -v hc >/dev/null 2>&1 || [ -x "$BIN_DIR/hc" ]; }
27
+
28
+ # Print a string quoted for a shell to read back as one word: it's -> 'it'\''s'.
29
+ # LC_ALL=C: sed must not give up on a name that is not valid text in this locale.
30
+ sh_quote() { printf "'%s'" "$(printf '%s' "$1" | LC_ALL=C sed "s/'/'\\\\''/g")"; }
31
+
18
32
  # Herdr answers `status` with the layout it shows only while its window is open.
19
33
  herdr_running() { herdr_app status 2>/dev/null | grep -q '"layout"'; }
20
34
 
@@ -24,9 +38,15 @@ require_herdr() {
24
38
  [ -d "$APP_HOME" ] || die "$APP_HOME does not exist yet. Open Herdr once so it creates its folder, then run this again."
25
39
  }
26
40
 
27
- # Print a string as the inside of a JSON string. sed and awk do the work so
28
- # that the result does not depend on the bash version's quoting rules.
41
+ # Print a string as the inside of a JSON string. Most strings have nothing to
42
+ # escape and are printed as they are, with no program started. For the rest,
43
+ # sed and awk do the work so that the result does not depend on the bash
44
+ # version's quoting rules.
29
45
  json_str() {
46
+ case $1 in
47
+ *[\\\"[:cntrl:]]*) ;;
48
+ *) printf '%s' "$1"; return ;;
49
+ esac
30
50
  printf '%s' "$1" | tr '\t\r' ' ' |
31
51
  sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' |
32
52
  awk 'BEGIN { ORS = "" } NR > 1 { print "\\n" } { print }'
@@ -128,8 +128,34 @@ project_open() {
128
128
  show_space "$name" "$dir"
129
129
  }
130
130
 
131
+ # The same list for programs: one line of JSON, each project with its folder
132
+ # (as project_dir prints it) and its repos. The projects mod reads this.
133
+ project_ls_json() {
134
+ local d repo sep='' rsep
135
+ printf '{"projects":['
136
+ for d in "$PROJECTS"/*/; do
137
+ [ -d "$d" ] || continue
138
+ d=${d%/}
139
+ printf '%s{"name":"%s","folder":"%s","repos":[' "$sep" \
140
+ "$(json_str "${d##*/}")" "$(json_str "$(cd -P "$d" && pwd)")"
141
+ rsep=''
142
+ while IFS= read -r repo; do
143
+ printf '%s"%s"' "$rsep" "$(json_str "$repo")"
144
+ rsep=,
145
+ done < <(project_repos "$d")
146
+ printf ']}'
147
+ sep=,
148
+ done
149
+ printf ']}\n'
150
+ }
151
+
131
152
  project_ls() {
132
153
  local d any=0 repo
154
+ case ${1:-} in
155
+ --json) project_ls_json; return ;;
156
+ '') ;;
157
+ *) die "unknown option for project ls: $1" ;;
158
+ esac
133
159
  for d in "$PROJECTS"/*/; do
134
160
  [ -d "$d" ] || continue
135
161
  any=1
@@ -156,6 +182,18 @@ check_projects() {
156
182
  is_repo "$repo" || { say " problem ${d##*/}: $repo is missing or is not a git repo"; bad=$((bad + 1)); }
157
183
  done < <(project_repos "$d")
158
184
  [ "$bad" -gt 0 ] || say " ok ${d##*/}"
185
+ # Notes say what a repo does not provide. They are not problems: a task
186
+ # in the project still starts, only without that step.
187
+ if have_just; then
188
+ while IFS= read -r repo; do
189
+ is_repo "$repo" || continue
190
+ case $(recipe_state "$repo" setup) in
191
+ no-justfile) say " note ${d##*/}: ${repo##*/} has no justfile, so tasks start without setup" ;;
192
+ no-recipe) say " note ${d##*/}: ${repo##*/}'s justfile has no setup recipe" ;;
193
+ unreadable) say " note ${d##*/}: ${repo##*/}'s justfile could not be read by just" ;;
194
+ esac
195
+ done < <(project_repos "$d")
196
+ fi
159
197
  problems=$((problems + bad))
160
198
  done
161
199
  return "$problems"
@@ -166,7 +204,7 @@ cmd_project() {
166
204
  new) shift; project_new "$@" ;;
167
205
  add) shift; project_add "$@" ;;
168
206
  open) shift; project_open "$@" ;;
169
- ls | list) shift; project_ls ;;
207
+ ls | list) shift; project_ls "$@" ;;
170
208
  *) die "usage: entourage project new|add|open|ls (see: entourage help)" ;;
171
209
  esac
172
210
  }
@@ -0,0 +1,32 @@
1
+ # What a repo provides: recipes in a justfile at its root (https://just.systems).
2
+ # entourage knows recipes by name only, never what they do. This file is the
3
+ # only place that runs `just`.
4
+
5
+ have_just() { command -v just >/dev/null 2>&1; }
6
+
7
+ # Print the justfile at a folder's own root, or return 1 when it has none.
8
+ # `just` would also look in the folders above; a recipe from another project's
9
+ # justfile must never be run in a repo, so only the root counts.
10
+ root_justfile() {
11
+ local dir=$1 name
12
+ for name in justfile Justfile .justfile; do
13
+ if [ -f "$dir/$name" ]; then printf '%s\n' "$dir/$name"; return 0; fi
14
+ done
15
+ return 1
16
+ }
17
+
18
+ # Print whether a folder provides a recipe, as one word:
19
+ # ok its justfile has the recipe
20
+ # no-justfile it has no justfile at its root
21
+ # no-recipe its justfile has no recipe of that name
22
+ # unreadable just could not read its justfile
23
+ recipe_state() {
24
+ local dir=$1 recipe=$2 file names
25
+ file=$(root_justfile "$dir") || { echo no-justfile; return 0; }
26
+ # --summary prints the recipe names on one line, separated by spaces.
27
+ names=$(just --justfile "$file" --summary 2>/dev/null) || { echo unreadable; return 0; }
28
+ case " $(printf '%s' "$names" | tr '\n\t' ' ') " in
29
+ *" $recipe "*) echo ok ;;
30
+ *) echo no-recipe ;;
31
+ esac
32
+ }
package/cli/lib/task.sh CHANGED
@@ -104,11 +104,114 @@ task_undo() {
104
104
  [ ! -e "$tdir" ] || printf 'entourage: could not remove everything in %s\n' "$tdir" >&2
105
105
  }
106
106
 
107
+ # Get a new task ready to work in: type `just setup` into its tab's shell for
108
+ # every repo that provides the recipe (see recipes.sh). It runs there, not
109
+ # here, so that `task start` returns at once and the install is on screen
110
+ # where the work will happen. Nothing in this step can fail the task: by now
111
+ # it exists and its tab is open.
112
+ # $1 the task's folder $2 what `tab.new` printed $3... the task's repos
113
+ run_setup() {
114
+ local tdir=$1 tab=$2 repo name line='' term count ready=() groups i=0
115
+ shift 2
116
+ count=$#
117
+ if ! have_just; then
118
+ say " setup skipped: just is not installed (https://just.systems)"
119
+ return 0
120
+ fi
121
+ for repo in "$@"; do
122
+ name=${repo##*/}
123
+ # This repo's groups, if its target named any: handed to its recipe as is.
124
+ groups=${TASK_GROUPS[$i]:-}; i=$((i + 1))
125
+ case $(recipe_state "$tdir/$name" setup) in
126
+ ok)
127
+ ready+=("$name${groups:+ $groups}")
128
+ # One repo: the tab is already in its worktree. Several: the tab is in
129
+ # the task folder above them, and they run one after another. The ./
130
+ # keeps the shell's CDPATH, and a name starting with a dash, from
131
+ # sending cd somewhere else.
132
+ if [ "$count" -eq 1 ]; then line="just setup${groups:+ $groups}"
133
+ else line=${line:+$line && }"(cd ./$(sh_quote "$name") && just setup${groups:+ $groups})"
134
+ fi
135
+ ;;
136
+ no-justfile) say " setup $name skipped: no justfile" ;;
137
+ no-recipe) say " setup $name skipped: its justfile has no setup recipe" ;;
138
+ *) say " setup $name skipped: its justfile could not be read by just" ;;
139
+ esac
140
+ done
141
+ [ -n "$line" ] || return 0
142
+ # tab.new prints the address of the terminal it made, as "terminal": "t8".
143
+ term=$(printf '%s\n' "$tab" | sed -n 's/.*"terminal": *"\([^"]*\)".*/\1/p' | head -n 1) || term=
144
+ # hc types the line once the new shell has gone quiet: a second or two.
145
+ if [ -n "$term" ] && have_hc && hc_cmd send "$term" "$line" >/dev/null 2>&1; then
146
+ for name in "${ready[@]}"; do say " setup $name (running in the tab)"; done
147
+ return 0
148
+ fi
149
+ say " setup could not be started; run it yourself in the tab: $line"
150
+ }
151
+
152
+ # A group is a part of a repo, named by the repo itself: a plain word, because
153
+ # it is typed into the tab's shell. Lowercase letters, digits and dashes, not
154
+ # starting with a dash. Every allowed character is spelled out: a range like
155
+ # a-z means different things in different locales, and in some it lets
156
+ # uppercase letters and shell punctuation through.
157
+ valid_group() {
158
+ case ${1:-} in
159
+ '' | -* | *[!abcdefghijklmnopqrstuvwxyz0123456789-]*) return 1 ;;
160
+ esac
161
+ }
162
+
163
+ # What `task start` was asked to work on, from its targets:
164
+ # TARGET_REPOS the repo each target names
165
+ # TARGET_GROUPS that target's groups, separated by spaces ('' for the whole repo)
166
+ # and, once the task's repos are chosen, in the same order as them:
167
+ # TASK_GROUPS each repo's groups
168
+ TARGET_REPOS=() TARGET_GROUPS=() TASK_GROUPS=()
169
+
170
+ # Read targets of the form <repo>[:<group>[,<group>...]] into TARGET_REPOS and
171
+ # TARGET_GROUPS, or stop. entourage checks a group's shape only: what a group
172
+ # means, and whether it exists, is the repo's business.
173
+ # $1 the project $2... the project's repos, then --, then the targets
174
+ parse_targets() {
175
+ local name=$1 known=() arg repo groups group found r i
176
+ shift
177
+ while [ "$#" -gt 0 ] && [ "$1" != -- ]; do known+=("${1##*/}"); shift; done
178
+ shift
179
+ TARGET_REPOS=() TARGET_GROUPS=()
180
+ for arg in "$@"; do
181
+ repo=${arg%%:*}
182
+ found=0
183
+ for r in "${known[@]}"; do [ "$r" != "$repo" ] || found=1; done
184
+ [ "$found" = 1 ] ||
185
+ die "'$repo' is not a repo in project '$name'. Its repos are: ${known[*]}"
186
+ i=0
187
+ while [ "$i" -lt "${#TARGET_REPOS[@]}" ]; do
188
+ [ "${TARGET_REPOS[$i]}" != "$repo" ] ||
189
+ die "'$repo' is named twice. Give its groups together, separated by a comma, like: $repo:athlete,coach"
190
+ i=$((i + 1))
191
+ done
192
+ groups=''
193
+ case $arg in
194
+ *:*)
195
+ # Split on commas by hand: an empty group (a trailing or doubled
196
+ # comma) has to be caught, not skipped.
197
+ r=${arg#*:},
198
+ while [ -n "$r" ]; do
199
+ group=${r%%,*}; r=${r#*,}
200
+ valid_group "$group" ||
201
+ die "'$group' in '$arg' is not a group name. A group is lowercase letters, digits and dashes, like: $repo:athlete"
202
+ groups=${groups:+$groups }$group
203
+ done
204
+ ;;
205
+ esac
206
+ TARGET_REPOS+=("$repo"); TARGET_GROUPS+=("$groups")
207
+ done
208
+ }
209
+
107
210
  task_start() {
108
211
  local name=${1:-} branch=${2:-} dir task
109
212
  dir=$(project_dir "$name")
110
213
  [ -n "$branch" ] ||
111
- die "which branch? Usage: entourage task start $name <type>/<description> (see https://conventionalbranch.org)"
214
+ die "which branch? Usage: entourage task start $name <type>/<description> [<repo>[:<group>[,<group>...]] ...] (see https://conventionalbranch.org)"
112
215
  valid_branch "$branch" ||
113
216
  die "'$branch' is not a branch name entourage accepts. Use <type>/<description>, like: feat/abc-122-short-title (see https://conventionalbranch.org)"
114
217
  task=$(task_name "$branch")
@@ -117,10 +220,28 @@ task_start() {
117
220
  herdr_running || die "Herdr is not running. Open it, then run this again."
118
221
 
119
222
  # Check everything before making anything.
120
- local repos=() bases=() repo base i tdir=$dir/tasks/$task
121
- while IFS= read -r repo; do repos+=("$repo"); done < <(project_repos "$dir")
122
- [ "${#repos[@]}" -gt 0 ] ||
223
+ local all=() repos=() bases=() repo base i tdir=$dir/tasks/$task
224
+ while IFS= read -r repo; do all+=("$repo"); done < <(project_repos "$dir")
225
+ [ "${#all[@]}" -gt 0 ] ||
123
226
  die "project '$name' has no repos. Add one with: entourage project add $name <path>"
227
+ # The task's repos are the ones its targets name, or every repo when there
228
+ # are no targets, always in the order of the project's repos file.
229
+ shift 2
230
+ parse_targets "$name" "${all[@]}" -- "$@"
231
+ TASK_GROUPS=()
232
+ for repo in "${all[@]}"; do
233
+ if [ "${#TARGET_REPOS[@]}" -eq 0 ]; then
234
+ repos+=("$repo"); TASK_GROUPS+=('')
235
+ continue
236
+ fi
237
+ i=0
238
+ while [ "$i" -lt "${#TARGET_REPOS[@]}" ]; do
239
+ if [ "${TARGET_REPOS[$i]}" = "${repo##*/}" ]; then
240
+ repos+=("$repo"); TASK_GROUPS+=("${TARGET_GROUPS[$i]}")
241
+ fi
242
+ i=$((i + 1))
243
+ done
244
+ done
124
245
  for repo in "${repos[@]}"; do
125
246
  is_repo "$repo" || die "$repo is missing or is not a git repo (see: entourage status)"
126
247
  done
@@ -180,8 +301,10 @@ task_start() {
180
301
  die "made the task at $folder but could not show it in Herdr. Open that folder in the project's space yourself."
181
302
  # No `space` argument: the tab goes in the selected space, which show_space
182
303
  # has just selected or made.
183
- herdr_app do tab.new "{\"name\":\"$task\",\"folder\":\"$folder\"}" >/dev/null 2>&1 ||
304
+ local tab
305
+ tab=$(herdr_app do tab.new "{\"name\":\"$task\",\"folder\":\"$folder\"}" 2>/dev/null) ||
184
306
  die "made the task at $folder but could not open its tab. Is Herdr open?"
307
+ run_setup "$tdir" "$tab" "${repos[@]}"
185
308
  say "Opened task '$task' on branch $branch"
186
309
  }
187
310
 
@@ -189,6 +312,6 @@ cmd_task() {
189
312
  case ${1:-} in
190
313
  new) shift; task_new "$@" ;;
191
314
  start) shift; task_start "$@" ;;
192
- *) die "usage: entourage task new <project> <card>, or: entourage task start <project> <branch> (see: entourage help)" ;;
315
+ *) die "usage: entourage task new <project> <card>, or: entourage task start <project> <branch> [<repo>[:<group>[,<group>...]] ...] (see: entourage help)" ;;
193
316
  esac
194
317
  }
package/herdr/README.md CHANGED
@@ -9,8 +9,9 @@ layouts (whole-window arrangements of mods).
9
9
  |---|---|
10
10
  | `mods/cpu/` | Live CPU usage with a scrolling history. macOS only (reads `/usr/bin/top`). |
11
11
  | `mods/layout-switch/` | A dropdown that shows the current layout and switches to another. |
12
+ | `mods/projects/` | Every project in your config, open or not. Click one to show its space. |
12
13
  | `layouts/default.json` | Herdr's own layout, plus the layout dropdown. |
13
- | `layouts/test.json` | `default` plus the CPU mod in the sidebar. |
14
+ | `layouts/test.json` | `default` with the projects list in place of spaces, plus the CPU mod in the sidebar. |
14
15
  | `projects/template/` | The starting `PROJECT.md` for every new project. |
15
16
 
16
17
  The skills are in [../skills/](../skills/), outside this folder. They are
@@ -102,6 +103,8 @@ template is in this repo. Your own projects are in
102
103
  - **Open it:** `entourage project open <name>` rebuilds the links and shows
103
104
  the project's space, making it if it is not open. The space's folder is the
104
105
  project folder.
106
+ - **List them:** `entourage project ls`. `--json` prints the same list as
107
+ JSON with each project's folder; the projects mod reads it.
105
108
  - **Check them:** `entourage status` reports a repo that has moved or gone,
106
109
  and a `PROJECT.md` that is still the template. Delete the template's first
107
110
  line once you have filled it in.
@@ -126,10 +129,10 @@ entourage task new <project> <card>
126
129
  project folder, and starts an agent in it. The agent is `claude`;
127
130
  `ENTOURAGE_AGENT` picks another command.
128
131
  - **The agent's first message** is [prompts/task-new.md](../prompts/task-new.md)
129
- with the card and project filled in. It tells the agent to run
130
- `sdlc-define`, `sdlc-plan` and `sdlc-breakdown` in order, in that one
131
- session, and to wait for your approval at the end. Edit that file to change
132
- what the agent is told.
132
+ with the card and project filled in. It tells the agent to start with
133
+ `sdlc-define` and follow each skill's handoff block to the next
134
+ (`sdlc-plan`, then `sdlc-breakdown`), in that one session, and to wait for
135
+ your approval at the end. Edit that file to change what the agent is told.
133
136
  - **It makes no branch, worktree or task folder.** The card has no type until
134
137
  the agent has defined it, and the type is the start of the branch name.
135
138
  - **It checks first.** An unknown project, something that is not a card ID,
@@ -139,13 +142,30 @@ entourage task new <project> <card>
139
142
 
140
143
  ### Starting the work
141
144
 
142
- One branch, checked out as a git worktree of every repo in the project, and
145
+ One branch, checked out as a git worktree of the repos the task needs, and
143
146
  shown as a tab in the project's space.
144
147
 
145
148
  ```sh
146
- entourage task start <project> <branch>
149
+ entourage task start <project> <branch> [<repo>[:<group>[,<group>...]] ...]
147
150
  ```
148
151
 
152
+ - **Targets say what the task works on.** Each one names a repo of the
153
+ project by its folder name, and optionally groups inside it:
154
+
155
+ | After the branch | The task gets |
156
+ |---|---|
157
+ | nothing | every repo of the project, each with its whole setup |
158
+ | `app:athlete` | the `app` repo, set up for its `athlete` group |
159
+ | `app:athlete,coach` | `app`, set up for both groups |
160
+ | `app:athlete billing` | two repos: `app` for `athlete`, and all of `billing` |
161
+
162
+ A repo that is not named gets no worktree and no setup; read it through the
163
+ project's `links/`. A group is the repo's own word for a part of itself
164
+ (see [What a repo provides](#what-a-repo-provides)): lowercase letters,
165
+ digits and dashes. entourage passes it on and does not check that the repo
166
+ knows it. A repo whose folder name has a colon in it cannot be named as a
167
+ target.
168
+
149
169
  - **The branch is `<type>/<description>`**, following
150
170
  [Conventional Branch](https://conventionalbranch.org): `feat/abc-122-insert-task-here`,
151
171
  `fix/abc-140-header-bug`, `chore/update-dependencies`. Put the card's ID in
@@ -153,14 +173,24 @@ entourage task start <project> <branch>
153
173
  `release` and `chore`, plus `ai`, `claude`, `codex`, `copilot` and `cursor`.
154
174
  - **The description names the task.** `feat/abc-122-insert-task-here` makes
155
175
  the folder `tasks/abc-122-insert-task-here` and a tab of that name.
156
- - **Each repo gets a worktree** at `tasks/<task>/<repo>`, on the new branch,
176
+ - **Each of the task's repos gets a worktree** at `tasks/<task>/<repo>`, on the new branch,
157
177
  cut from the remote's default branch after a fetch. A repo that cannot be
158
178
  fetched starts from what is local, with a warning.
159
179
  - **The repos' own checkouts are not touched.** They stay on whatever branch
160
180
  they were on.
161
- - **Where the tab starts:** in the worktree when the project has one repo; in
181
+ - **Where the tab starts:** in the worktree when the task has one repo; in
162
182
  the task folder when it has several. That folder has `CLAUDE.md` and
163
183
  `AGENTS.md` links to the project's `PROJECT.md`.
184
+ - **Setup runs in the tab.** For each repo that has a `setup` recipe (see
185
+ [What a repo provides](#what-a-repo-provides)), `just setup`, followed by
186
+ the target's groups if it named any, is typed into
187
+ the new tab's shell, so `task start` returns within a second or two and you
188
+ watch the install where you will work. With several repos they run one after another,
189
+ and one that fails stops the rest. A repo without the recipe is skipped and
190
+ named in the output.
191
+ - **Setup never fails the task.** The task and its tab are there either way.
192
+ Without `just`, the output says setup was skipped. If the line could not be
193
+ typed into the tab, the output gives you the line to run yourself.
164
194
  - **Nothing is made unless everything can be.** A task or branch of that name
165
195
  that already exists, a missing repo, or Herdr not running stops it first,
166
196
  and a worktree that fails partway is undone.
@@ -168,6 +198,33 @@ entourage task start <project> <branch>
168
198
  `git worktree remove <project folder>/tasks/<task>/<repo>` and
169
199
  `git branch -D <branch>`, then delete the task's folder and close its tab.
170
200
 
201
+ ## What a repo provides
202
+
203
+ entourage knows nothing about how a repo is built or run. A repo says so
204
+ itself, in a [justfile](https://just.systems) at its root, with recipes that
205
+ have the same names in every repo. entourage only knows the names.
206
+
207
+ | Recipe | What it must do | Used by |
208
+ |---|---|---|
209
+ | `setup` | Make a fresh checkout ready to work in: install dependencies and anything else a new worktree lacks. Safe to run twice. Called with group names (`just setup athlete coach`), make ready only what those groups need, and fail with a clear message for a group the repo does not have. | `entourage task start` |
210
+
211
+ ```just
212
+ setup:
213
+ npm install
214
+ ```
215
+
216
+ - **Only a justfile at the repo's own root counts**: `justfile`, `Justfile` or
217
+ `.justfile`. One in a folder above is never used.
218
+ - **A repo with several codebases names its own groups**, such as `athlete`
219
+ for a web app with the API and database it needs. A target like
220
+ `app:athlete` reaches the recipe as `just setup athlete`. A repo with one
221
+ codebase needs none: its `setup` takes no arguments.
222
+ - **`entourage status` notes** each repo with no justfile or no `setup`
223
+ recipe. A note is not a problem: tasks in that project still start, without
224
+ setup.
225
+ - **`just` has to be installed** on the machine. Without it, tasks start
226
+ without setup and `entourage status` says so.
227
+
171
228
  ## Changing things
172
229
 
173
230
  - Work from a git clone, not the npm install: clone the repo and run
@@ -36,10 +36,10 @@
36
36
  "type": "column",
37
37
  "children": [
38
38
  {
39
- "id": "spaces",
39
+ "id": "projects",
40
40
  "type": "block",
41
41
  "content": {
42
- "mod": "spaces"
42
+ "mod": "projects"
43
43
  },
44
44
  "size": {
45
45
  "weight": 1
@@ -0,0 +1,167 @@
1
+ // Every project in the entourage config, open or not. Herdr only knows a
2
+ // project while its space has a tab, so the list comes from the entourage
3
+ // command, which owns where projects live and what counts as one. Click a
4
+ // project to show its space; one with no space is opened by the command.
5
+ import { View, div } from "gpui-kit";
6
+ import { v_flex, h_flex } from "gpui-base";
7
+ import { exec, spaces, run, notify, theme, layout, window, checking, appHome } from "herdr";
8
+
9
+ const REFRESH_MS = 15000; // projects change rarely; the open marks are live anyway
10
+ const TIMEOUT_MS = 10000;
11
+ const ROW = 30;
12
+ const RAIL_CELL = 32;
13
+ // How this mod's own link into the repo that ships it ends.
14
+ const LINKED_AT = "/herdr/mods/projects";
15
+ const EMPTY = "No projects yet. Make one with: entourage project new <name>";
16
+ const OLD_CLI = "This entourage cannot list projects as JSON. Run: entourage update";
17
+
18
+ function find(node, id) {
19
+ if (node?.id === id) return node;
20
+ for (const child of node?.children ?? []) {
21
+ const found = find(child, id);
22
+ if (found) return found;
23
+ }
24
+ return null;
25
+ }
26
+
27
+ // The sidebar's rail goes by its width, as in Herdr's own lists.
28
+ const narrow = () => (find(layout(), "sidebar")?.size?.px ?? Infinity) < 160;
29
+
30
+ // The listing, or null when the output is not the JSON this mod reads (an
31
+ // older entourage prints the plain list whatever the option).
32
+ function parse(text) {
33
+ try {
34
+ const list = JSON.parse(text).projects;
35
+ return Array.isArray(list) ? list : null;
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
40
+
41
+ // What a failed command said, without the name it starts its errors with.
42
+ const said = (r) => (r.stderr || r.stdout).trim().replace(/^entourage: /, "");
43
+
44
+ export default class Projects extends View {
45
+ init(_props, cx) {
46
+ this.projects = null; // null until the first listing answers
47
+ this.error = null;
48
+ this.busy = false;
49
+ this.opening = null; // the project a click is making a space for
50
+ this.cmd = "entourage"; // the one on PATH, until that cannot start
51
+ if (checking()) return;
52
+ cx.timer.every(REFRESH_MS, (cx) => this.refresh(cx));
53
+ this.refresh(cx);
54
+ }
55
+
56
+ // Runs the entourage command. With `fallback`, a command that cannot run is
57
+ // tried again as the copy this mod is linked from (Herdr may have been
58
+ // started without the user's PATH). Only the listing asks for that: it is
59
+ // safe to run twice, and it has answered before there is a row to click. An
60
+ // open never does, because its failure may be a timeout with the first run
61
+ // still making the space.
62
+ async entourage(args, { fallback = false } = {}) {
63
+ try {
64
+ return await exec(this.cmd, args, { timeout: TIMEOUT_MS });
65
+ } catch (e) {
66
+ if (!fallback || this.cmd !== "entourage") throw e;
67
+ const link = await exec("readlink", [`${appHome()}/mods/projects`]);
68
+ const at = link.stdout.trim();
69
+ if (link.code !== 0 || !at.endsWith(LINKED_AT)) throw e;
70
+ this.cmd = `${at.slice(0, -LINKED_AT.length)}/cli/entourage`;
71
+ return exec(this.cmd, args, { timeout: TIMEOUT_MS });
72
+ }
73
+ }
74
+
75
+ refresh(cx) {
76
+ // Skip while a listing is in flight or nobody can see the window.
77
+ if (this.busy || window()?.visible === false) return;
78
+ this.busy = true;
79
+ cx.spawn(async (cx) => {
80
+ try {
81
+ const r = await this.entourage(["project", "ls", "--json"], { fallback: true });
82
+ const list = r.code === 0 ? parse(r.stdout) : null;
83
+ if (list) this.projects = list;
84
+ this.error = list ? null : r.code === 0 ? OLD_CLI : said(r) || "entourage project ls failed";
85
+ } catch (e) {
86
+ this.error = `Could not run entourage: ${e?.message ?? e}`;
87
+ }
88
+ this.busy = false;
89
+ cx.notify();
90
+ });
91
+ }
92
+
93
+ // `space`: the project's open space, or null.
94
+ pick(p, space, cx) {
95
+ if (space) {
96
+ run("space.select", { id: space.id });
97
+ return;
98
+ }
99
+ // One at a time: a second open would not see the first one's space yet.
100
+ if (this.opening) return;
101
+ this.opening = p.name;
102
+ cx.notify();
103
+ cx.spawn(async (cx) => {
104
+ let failed = null;
105
+ try {
106
+ const r = await this.entourage(["project", "open", p.name]);
107
+ if (r.code !== 0) failed = said(r);
108
+ } catch (e) {
109
+ failed = String(e?.message ?? e);
110
+ }
111
+ if (failed !== null) notify({ title: `Could not open ${p.name}`, body: failed, level: "error" });
112
+ this.opening = null;
113
+ this.refresh(cx);
114
+ cx.notify();
115
+ });
116
+ }
117
+
118
+ row(p, space, t) {
119
+ const on = Boolean(space?.active);
120
+ const n = (p.repos ?? []).length;
121
+ const tail = this.opening === p.name ? "Opening…" : `${n} repo${n === 1 ? "" : "s"}`;
122
+ const dot = div().size(7).rounded(4).flex_none();
123
+ return h_flex().id(`project-${p.name}`).h(ROW).flex_none().px(8).gap(9).items_center().rounded(8)
124
+ .when(on, (el) => el.bg(t.selected))
125
+ .when(!on, (el) => el.hover((s) => s.bg(t.hover)))
126
+ .on_click((_e, cx) => this.pick(p, space, cx))
127
+ .child(h_flex().size(18).flex_none().items_center().justify_center()
128
+ .child(space ? dot.bg(t.ansi2) : dot.border_1().border_color(t.dim)))
129
+ .child(div().flex_1().min_w(0).truncate().text_color(space ? t.foreground : t.muted).child(p.name))
130
+ .child(div().flex_none().text_size(11.5).text_color(t.dim).child(tail));
131
+ }
132
+
133
+ // On the sidebar's rail: the project's first letter.
134
+ compact(p, space, t) {
135
+ const on = Boolean(space?.active);
136
+ return h_flex().flex_none().justify_center().child(
137
+ h_flex().id(`project-${p.name}`).w(RAIL_CELL).h(26).rounded(6).items_center().justify_center()
138
+ .tooltip(p.name)
139
+ .when(on, (el) => el.bg(t.selected))
140
+ .when(!on, (el) => el.hover((s) => s.bg(t.hover)))
141
+ .on_click((_e, cx) => this.pick(p, space, cx))
142
+ .child(div().text_color(space ? t.foreground : t.dim).child((p.name[0] ?? "?").toUpperCase())));
143
+ }
144
+
145
+ render() {
146
+ const t = theme();
147
+ const collapsed = narrow();
148
+ // A project is open when a space on this computer has its folder.
149
+ const local = spaces().filter((s) => !s.machine);
150
+ const note = (text, color) => div().px(8).py(6).text_size(12).text_color(color).child(text);
151
+ const items = [];
152
+ if (!collapsed) {
153
+ if (this.error) items.push(note(this.error, t.blocked));
154
+ else if (this.projects === null) items.push(note("Loading…", t.dim));
155
+ else if (this.projects.length === 0) items.push(note(EMPTY, t.dim));
156
+ }
157
+ for (const p of this.projects ?? []) {
158
+ const space = local.find((s) => s.folder === p.folder) ?? null;
159
+ items.push(collapsed ? this.compact(p, space, t) : this.row(p, space, t));
160
+ }
161
+ return v_flex().size_full().min_h(0).bg(t.chrome).text_size(13)
162
+ .child(h_flex().h(31).flex_none().pl(16).pr(10).items_center().text_size(11.5).text_color(t.dim)
163
+ .when(!collapsed, (el) => el.child("Projects")))
164
+ .child(v_flex().id("project-list").flex_1().min_h(0).px(collapsed ? 0 : 8).pb(14)
165
+ .overflow_y_scrollbar().mode("always").children(items));
166
+ }
167
+ }
@@ -0,0 +1 @@
1
+ { "place": "none", "title": "Projects" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngaynor/entourage",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "A software factory: agent skills and the Herdr setup to run them, installed with one command.",
5
5
  "bin": {
6
6
  "entourage": "cli/entourage"
@@ -1,13 +1,16 @@
1
1
  Write up Linear card {card} so that it is ready to build. This session is in the entourage project `{project}`.
2
2
 
3
- Use these three skills, in this order: sdlc-define, then sdlc-plan, then sdlc-breakdown.
3
+ Start with the sdlc-define skill. Each skill ends by writing a handoff block. Write each one before you start the next skill, even though you carry straight on: the blocks are how I see how each step ended. You are driving this run, so act on the block's `status`:
4
4
 
5
- - Do all three yourself, in this session. Don't hand a step to a subagent.
6
- - Finish each skill's section on the card before you start the next skill.
7
- - When a skill tells you to report and stop, carry on to the next skill instead. I only need to hear from you when a skill says to ask me something, and at the end.
8
- - sdlc-breakdown ends by asking me to approve the card. Wait for my answer.
5
+ - `done`: go straight on to the step in `next`, without waiting for me. `plan` is the sdlc-plan skill and `breakdown` is the sdlc-breakdown skill.
6
+ - `needs-human`: wait for my answer, then carry on with the same skill.
7
+ - `failed`: stop there. Don't start the next skill.
9
8
 
10
- Once I approve, give me the command that starts the work, and don't run it yourself:
9
+ If I ask for a change when I'm approving, sdlc-breakdown tells you which skill makes it. When that skill hands off, go back to sdlc-breakdown, not on to `next`.
10
+
11
+ Do every step yourself, in this session. Don't hand a step to a subagent.
12
+
13
+ sdlc-breakdown asks me to approve the card. When it hands off with `next: setup`, the card is approved. Give me the command that starts the work, and don't run it yourself:
11
14
 
12
15
  entourage task start {project} <type>/<card-id>-<short-name>
13
16
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sdlc-breakdown
3
- description: Decide whether a planned Linear card is one piece or several, by cutting it into thin end-to-end slices (elephant carpaccio) where it can be cut, then, once John approves, creating each slice as a sub-issue. Use this after plan on every card, and whenever asked to break down, slice or split a card, or to judge whether a card is too big for one pull request.
3
+ description: Decide whether a planned Linear card is one piece or several, by cutting it into thin end-to-end slices (elephant carpaccio) where it can be cut, then, once the human approves, creating each slice as a sub-issue. Use this after plan on every card, and whenever asked to break down, slice or split a card, or to judge whether a card is too big for one pull request.
4
4
  ---
5
5
 
6
6
  # Break down a card
@@ -11,20 +11,20 @@ The method is elephant carpaccio: cut the work into slices so thin that each one
11
11
 
12
12
  Thin slices matter more when an agent is building. Each slice can be checked end to end as soon as it merges, a mistake stays inside one small pull request, and if the third slice never ships, the first two still work.
13
13
 
14
- This skill has two parts. Proposing, and asking John to approve, happens on every card. Creating sub-issues happens only after he approves a card that was sliced.
14
+ This skill has two parts. Proposing, and asking the human to approve, happens on every card. Creating sub-issues happens only after they approve a card that was sliced.
15
15
 
16
16
  ## Before you write anything
17
17
 
18
18
  1. Read the card with the Linear tools: the Specification and the Plan.
19
19
  2. If either is missing, the earlier step hasn't run. Say so and stop.
20
- 3. If the card is itself a sub-issue, don't slice it again. Slices go one level deep. If it looks too big, tell John.
21
- 4. If the card already has a Breakdown section, don't write a second one. Tell John and ask whether he wants it revised.
20
+ 3. If the card is itself a sub-issue, don't slice it again. Slices go one level deep. If it looks too big, say so when you ask the human to approve.
21
+ 4. If the card already has a Breakdown section, don't write a second one. If the human has asked for it to be revised, revise it in place. Otherwise tell the human and ask whether they want it revised, and if they don't, go on to ask them to approve the card.
22
22
 
23
23
  ## Part 1: Propose
24
24
 
25
25
  ### First, is it already small?
26
26
 
27
- Look at the plan's Changes. If the whole card is one agent, one sitting and one quick pull request, it stands as one piece, even if you could cut it further. Every slice costs John a review and a merge, so don't slice for its own sake.
27
+ Look at the plan's Changes. If the whole card is one agent, one sitting and one quick pull request, it stands as one piece, even if you could cut it further. Every slice costs the human a review and a merge, so don't slice for its own sake.
28
28
 
29
29
  ### If it is too big, try to cut it
30
30
 
@@ -55,17 +55,17 @@ Then check the set:
55
55
  - **Each slice has its own Done when**, one to four outcomes written by the same rules as the card's.
56
56
  - **The slices run in order.** Each builds on the last.
57
57
 
58
- Two to five slices is usual. If you need more than six, the card is probably several cards. Propose what you have and say so when you finish.
58
+ Two to five slices is usual. If you need more than six, the card is probably several cards. Propose what you have and say so when you ask the human to approve.
59
59
 
60
60
  ### If it can't be cut
61
61
 
62
62
  Some work has no cut that passes the checks. A refactor may have nothing to click halfway through. A migration may have to land together. A first slice may not be acceptable for users to see without the rest.
63
63
 
64
- Then the card stands as one piece, however large it is. Don't force a cut that fails a check. A horizontal slice is worse than a large card, because it merges something nobody can test. Say in one line why it can't be cut, and if it is large, tell John when you finish.
64
+ Then the card stands as one piece, however large it is. Don't force a cut that fails a check. A horizontal slice is worse than a large card, because it merges something nobody can test. Say in one line why it can't be cut, and if it is large, say so when you ask the human to approve.
65
65
 
66
66
  ### Write it to the card
67
67
 
68
- Append a Breakdown section below the Plan. Leave it open, not collapsible, because it is what John reads to approve the card. Change nothing above it.
68
+ Append a Breakdown section below the Plan. Leave it open, not collapsible, because it is what the human reads to approve the card. Change nothing above it.
69
69
 
70
70
  For one piece:
71
71
 
@@ -85,31 +85,40 @@ For slices:
85
85
  - [ ] …
86
86
  ```
87
87
 
88
- Create nothing else in Linear yet. A proposal John turns down should leave nothing behind to clean up.
88
+ Create nothing else in Linear yet. A proposal the human turns down should leave nothing behind to clean up.
89
89
 
90
- ### Ask John to approve
90
+ ### Ask the human to approve
91
91
 
92
- Breakdown is the last step before building, so it ends by asking John to approve the whole card: the Specification, the Plan and the Breakdown together. This happens on every card, sliced or not.
92
+ Breakdown is the last step before building, so it ends by asking the human to approve the whole card: the Specification, the Plan and the Breakdown together. This happens on every card, sliced or not.
93
93
 
94
- Give him a summary he can answer from without opening Linear:
94
+ Give them a summary they can answer from without opening Linear:
95
95
 
96
96
  - The type.
97
97
  - The Done when list.
98
98
  - The approach, in a sentence or two.
99
99
  - Whether it is one piece or several, and why. If several, the slice names in order.
100
100
 
101
- Then ask him to approve or say what to change, and wait.
101
+ Then ask them to approve or say what to change. The summary goes above the handoff block, and the block is the ask:
102
102
 
103
- | John says | Then |
103
+ ```
104
+ phase: breakdown
105
+ status: needs-human
106
+ question: Approve <card ID> as specified, planned and broken down?
107
+ options: approve | change breakdown | change plan | change specification
108
+ ```
109
+
110
+ Wait for their answer.
111
+
112
+ | The human says | Then |
104
113
  |---|---|
105
114
  | Change the breakdown | Revise the Breakdown section and ask again |
106
- | Change the Specification or the Plan | Make the change by that section's own skill, `sdlc-define` or `sdlc-plan`. Then re-check every section below the one that changed, because a new Done when item can make the Plan and the Breakdown wrong. Ask again |
107
- | Yes, and the card is one piece | Tell him the card is approved and ready to build. Setup and build aren't built yet, so stop there |
108
- | Yes, and the card is sliced | Go on to part 2 |
115
+ | Change the Specification or the Plan | Make the change by that section's own skill, `sdlc-define` or `sdlc-plan`, as a revision the human asked for. That skill ends with its own `done` block, whose `next` does not apply here: come back to this step and re-check every section below the one that changed, because a new Done when item can make the Plan and the Breakdown wrong. Ask again |
116
+ | Approve, and the card is one piece | The card is ready to build. Hand off, as described below |
117
+ | Approve, and the card is sliced | Go on to part 2 |
109
118
 
110
119
  ## Part 2: Create the sub-issues
111
120
 
112
- Do this only when John has approved the card in this session, and only when the breakdown has more than one slice.
121
+ Do this only when the human has approved the card in this session, and only when the breakdown has more than one slice.
113
122
 
114
123
  For each slice, in order, create a sub-issue of the card:
115
124
 
@@ -125,21 +134,63 @@ A sub-issue has to stand alone. The build step will open it in a fresh session a
125
134
 
126
135
  Then update the parent's Breakdown list so each slice name carries its sub-issue's ID. The parent is not built. It stays as the record of the whole.
127
136
 
128
- Read the parent and each sub-issue back. Tell John what was created, in order, and which slice is first. Setup and build aren't built yet, so stop there.
137
+ Read the parent and each sub-issue back, then hand off.
138
+
139
+ ## Hand off
140
+
141
+ Breakdown is finished when the human has approved the card and, if it was sliced, its sub-issues exist. Then write the handoff block:
142
+
143
+ - `phase: breakdown`, `status: done` and `next: setup`.
144
+ - `summary`: that the card is approved, and whether it is one piece or sliced. If it was sliced, the sub-issues in order with their IDs, and which one is first.
145
+ - `flags`: anything that didn't go to plan, such as a blocking relation that couldn't be set.
146
+
147
+ Setup is not a skill. It is the `entourage task start` command, which the human runs, so there is no step for you to go on to.
148
+
149
+ ## The handoff block
150
+
151
+ Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
152
+
153
+ Write one handoff block every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Write it even when you go straight on to another step, because the block is the record that this one ended. Put it in a code block, one value per line, as the last thing you write for this step:
154
+
155
+ ```
156
+ phase: <this step>
157
+ status: <done, needs-human or failed>
158
+ next: <the step that follows>
159
+ summary: <one to three sentences on what you did>
160
+ flags: <what the human should know but wasn't asked>
161
+ question: <one question>
162
+ options: <the answers you expect, your recommendation first, separated by " | ">
163
+ reason: <what went wrong, and what you already tried>
164
+ ```
165
+
166
+ Which lines you write depends on the status:
167
+
168
+ | Status | Use it when | Lines |
169
+ |---|---|---|
170
+ | `done` | This step's work is on the card and you have read it back | `phase`, `status`, `next`, `summary`, and `flags` if there are any |
171
+ | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
172
+ | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
173
+
174
+ - **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
175
+ - **`needs-human` is a pause, not an ending.** Wait for the answer, then carry on with this step. The step is over only at `done` or `failed`.
176
+ - **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
177
+ - **Keep the block short.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
178
+ - **After `done`, this step is over.** Write the block before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
179
+ - **After `failed`, change nothing more.** Leave the card as it is for the human.
129
180
 
130
181
  ## If something goes wrong
131
182
 
132
183
  | When this happens | Do this |
133
184
  |---|---|
134
- | The card ID doesn't resolve | Ask John for the ID. Don't pick a card because its title looks similar |
185
+ | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
135
186
  | The Linear tools aren't available | Stop and say so. Show the finished section in the session so the work isn't lost. Don't save it somewhere else and report the step as done |
136
187
  | A write to the card fails | Read the card before doing anything else. Retry once, and only if the section isn't there, so it can't be added twice |
137
- | The read-back shows that text above your section changed | Put it back from what you read at the start of this run, append your section again, and tell John |
188
+ | The read-back shows that text above your section changed | Put it back from what you read at the start of this run, append your section again, and tell the human |
138
189
  | Creating the sub-issues stops partway | Don't start over. List the sub-issues the card already has, create only the missing ones, then set the blocking order |
139
- | A blocking relation can't be set | Tell John. The order is still on the parent's Breakdown list, so it isn't lost |
140
- | John's answer isn't a clear yes | Treat it as a change request. Ask what he wants changed, then ask for approval again |
190
+ | A blocking relation can't be set | Tell the human. The order is still on the parent's Breakdown list, so it isn't lost |
191
+ | The human's answer isn't a clear yes | Treat it as a change request. Ask what they want changed, then ask for approval again |
141
192
 
142
- If something fails that isn't on this list, stop and tell John what happened. Don't work around it.
193
+ If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
143
194
 
144
195
  ## Examples
145
196
 
@@ -7,7 +7,7 @@ description: Fill out a Linear card from its title and short description by sett
7
7
 
8
8
  Define is the first step of the lifecycle. It takes a card that holds a title and a sentence or two, and leaves it with a type and a Specification that says what is wanted and how anyone can tell it is done.
9
9
 
10
- Everything after this step is checked against the Specification. Plan maps its tests to Done when, breakdown cuts along it, build is finished when it is true, and John reads it to approve the card. A vague Specification doesn't slow an agent down. It gets built as whatever the agent guessed.
10
+ Everything after this step is checked against the Specification. Plan maps its tests to Done when, breakdown cuts along it, build is finished when it is true, and the human reads it to approve the card. A vague Specification doesn't slow an agent down. It gets built as whatever the agent guessed.
11
11
 
12
12
  Define says what and why. How it will be built belongs to plan, and whether it is one piece or several belongs to breakdown. Leave both alone here.
13
13
 
@@ -15,7 +15,7 @@ Define says what and why. How it will be built belongs to plan, and whether it i
15
15
 
16
16
  1. Get the card. If you weren't given a card ID, ask for one.
17
17
  2. Read the card with the Linear tools: title, description, labels and comments.
18
- 3. If the card already has a Specification section, don't write a second one. Tell John and ask whether he wants it revised.
18
+ 3. If the card already has a Specification section, don't write a second one. If the human has asked for it to be revised, revise it in place. Otherwise tell the human and ask whether they want it revised, and if they don't, hand off as `done` without changing it.
19
19
  4. Read the project's `PROJECT.md`, and look at only enough of the product, docs and code to use the right names and to know what exists today. Stop there. Working out the approach is plan's job, and doing it now tends to leak files and design into the Specification.
20
20
 
21
21
  ## 1. Set the type
@@ -31,7 +31,7 @@ Every card gets exactly one type. The types come from Conventional Branch, becau
31
31
  - If two could fit, take the first that does, in this order: `fix`, `feat`, `chore`.
32
32
  - Work the type out from the title and description even when the card already carries a type label. Labels get added by habit and are often wrong. Replace the label if yours differs.
33
33
  - Set the type as the card's label in the `Type` label group, which allows one per card. The name is lowercase and exact, because setup uses it as the branch prefix: `<type>/<card-id>-<short-name>`, for example `feat/abc-122-export-orders`.
34
- - If the work is really two types, such as a fix plus an unrelated clean-up, this card keeps its main change. Tell John about the other part and ask whether he wants a second card for it. Don't create that card yourself.
34
+ - If the work is really two types, such as a fix plus an unrelated clean-up, this card keeps its main change. Tell the human about the other part and ask whether they want a second card for it. Don't create that card yourself.
35
35
 
36
36
  The type is a label only. Don't write it into the card's text.
37
37
 
@@ -62,26 +62,26 @@ A checklist of three to seven items. A small chore can have fewer. Each item is
62
62
  - **A change that shouldn't alter behaviour, such as a refactor, always includes** "Existing tests pass without being changed." That is what shows behaviour didn't move.
63
63
  - **Don't split by layer.** An API change and the screen that depends on it belong on the same card. A card that stops at the API can't be checked by anyone using the product.
64
64
 
65
- If you end up with more than seven items, the card is probably more than one thing. Write the items anyway and say so when you finish. Breakdown deals with it after plan.
65
+ If you end up with more than seven items, the card is probably more than one thing. Write the items anyway and say so in `flags` when you hand off. Breakdown deals with it after plan.
66
66
 
67
67
  ### Out of scope
68
68
 
69
69
  Include this only when a reader would reasonably expect something that this card will not do. Otherwise leave it out.
70
70
 
71
- ## 3. When to ask John
71
+ ## 3. When to ask the human
72
72
 
73
73
  Ask in the session and wait for the answer when:
74
74
 
75
75
  - The title and description aren't enough to say who this is for or what done looks like.
76
- - An item depends on a product decision or a fact only he has, such as a limit, a wording, or which users.
76
+ - An item depends on a product decision or a fact only they have, such as a limit, a wording, or which users.
77
77
  - There are two readings that would give different Done when lists.
78
78
 
79
- Ask one question at a time, and offer your best guess so he can answer with a yes. Don't fill a gap with a guess or a placeholder. A made-up criterion reads exactly like a real one, and it will be built.
79
+ Ask one question at a time, in a handoff block with `status: needs-human`. Put your best guess first in `options`, so they can answer with a yes. Don't fill a gap with a guess or a placeholder. A made-up criterion reads exactly like a real one, and it will be built.
80
80
 
81
81
  ## 4. Write it to the card
82
82
 
83
83
  - Leave the original description exactly as it is, at the top. It is the original ask, and later steps read it.
84
- - Append the Specification below it as a collapsible section, so the card stays short when John opens it.
84
+ - Append the Specification below it as a collapsible section, so the card stays short when the human opens it.
85
85
  - Add nothing else. No type line, repo, risk or flags, and no approach or file names.
86
86
 
87
87
  Use this form:
@@ -100,29 +100,59 @@ Use this form:
100
100
 
101
101
  After writing, read the card back. Check that the original description is unchanged and that the Specification shows as a collapsed section.
102
102
 
103
- ## 5. Finish
103
+ ## 5. Hand off
104
104
 
105
- Tell John in two or three lines:
105
+ When the Specification is on the card and you have read it back, write the handoff block. Define is not finished until it is written:
106
106
 
107
- - The type you set, and whether you replaced a label that was already there.
108
- - How many Done when items there are.
109
- - Anything you weren't sure about, and whether the card looks like more than one thing.
107
+ - `phase: define`, `status: done` and `next: plan`.
108
+ - `summary`: the type you set, whether you replaced a label that was already there, and how many Done when items there are.
109
+ - `flags`: anything you weren't sure about, and whether the card looks like more than one thing.
110
110
 
111
- Then stop. Plan is the next step, and John may want to read the Specification first.
111
+ ## The handoff block
112
+
113
+ Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
114
+
115
+ Write one handoff block every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Write it even when you go straight on to another step, because the block is the record that this one ended. Put it in a code block, one value per line, as the last thing you write for this step:
116
+
117
+ ```
118
+ phase: <this step>
119
+ status: <done, needs-human or failed>
120
+ next: <the step that follows>
121
+ summary: <one to three sentences on what you did>
122
+ flags: <what the human should know but wasn't asked>
123
+ question: <one question>
124
+ options: <the answers you expect, your recommendation first, separated by " | ">
125
+ reason: <what went wrong, and what you already tried>
126
+ ```
127
+
128
+ Which lines you write depends on the status:
129
+
130
+ | Status | Use it when | Lines |
131
+ |---|---|---|
132
+ | `done` | This step's work is on the card and you have read it back | `phase`, `status`, `next`, `summary`, and `flags` if there are any |
133
+ | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
134
+ | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
135
+
136
+ - **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
137
+ - **`needs-human` is a pause, not an ending.** Wait for the answer, then carry on with this step. The step is over only at `done` or `failed`.
138
+ - **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
139
+ - **Keep the block short.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
140
+ - **After `done`, this step is over.** Write the block before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
141
+ - **After `failed`, change nothing more.** Leave the card as it is for the human.
112
142
 
113
143
  ## If something goes wrong
114
144
 
115
145
  | When this happens | Do this |
116
146
  |---|---|
117
- | The card ID doesn't resolve | Ask John for the ID. Don't pick a card because its title looks similar |
147
+ | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
118
148
  | The Linear tools aren't available | Stop and say so. Show the finished section in the session so the work isn't lost. Don't save it somewhere else and report the step as done |
119
149
  | A write to the card fails | Read the card before doing anything else. Retry once, and only if the section isn't there, so it can't be added twice |
120
- | The read-back shows that text above your section changed | Put it back from what you read at the start of this run, append your section again, and tell John |
121
- | The collapsed section shows as plain `>>>` text | Leave the content as it is and tell John. Don't keep reformatting it |
122
- | The `Type` label group, or the label you need, doesn't exist | Don't create it. Finish the Specification, and tell John which label is missing |
150
+ | The read-back shows that text above your section changed | Put it back from what you read at the start of this run, append your section again, and tell the human |
151
+ | The collapsed section shows as plain `>>>` text | Leave the content as it is and tell the human. Don't keep reformatting it |
152
+ | The `Type` label group, or the label you need, doesn't exist | Don't create it. Finish the Specification, and tell the human which label is missing |
123
153
  | The card carries more than one type label | Leave only the one you worked out |
124
154
 
125
- If something fails that isn't on this list, stop and tell John what happened. Don't work around it.
155
+ If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
126
156
 
127
157
  ## Example
128
158
 
@@ -7,7 +7,7 @@ description: Write the technical plan for a Linear card that already has a Speci
7
7
 
8
8
  Plan is the second step of the lifecycle. Define said what is wanted. Plan reads the code and says how it will be built: the approach, the files that change, and how each Done when item will be shown to be true.
9
9
 
10
- Two readers depend on it. John reads it to approve the card, so it has to be short and honest. The build step starts later in a fresh session with only the card, so the plan has to be exact enough to build from cold. A plan that says "update the orders module" helps neither of them.
10
+ Two readers depend on it. The human reads it to approve the card, so it has to be short and honest. The build step starts later in a fresh session with only the card, so the plan has to be exact enough to build from cold. A plan that says "update the orders module" helps neither of them.
11
11
 
12
12
  Plan only reads. It writes no code and makes no branch or worktree. Whether the card is one piece or several is breakdown's job, which comes next.
13
13
 
@@ -15,7 +15,7 @@ Plan only reads. It writes no code and makes no branch or worktree. Whether the
15
15
 
16
16
  1. Read the card with the Linear tools: the original description and the Specification.
17
17
  2. If there is no Specification, define hasn't run. Say so and stop.
18
- 3. If the card already has a Plan section, don't write a second one. Tell John and ask whether he wants it revised.
18
+ 3. If the card already has a Plan section, don't write a second one. If the human has asked for it to be revised, revise it in place. Otherwise tell the human and ask whether they want it revised, and if they don't, hand off as `done` without changing it.
19
19
 
20
20
  ## 1. Read the code
21
21
 
@@ -38,8 +38,8 @@ It has three parts.
38
38
 
39
39
  A few sentences on how it will be built. Name the existing pattern it follows and where that pattern lives.
40
40
 
41
- - If you chose between two real options, add one line on the one you rejected and why. It saves John asking.
42
- - If the work needs a new dependency, say so here. That is a decision John should see.
41
+ - If you chose between two real options, add one line on the one you rejected and why. It saves the human asking.
42
+ - If the work needs a new dependency, say so here. That is a decision the human should see.
43
43
  - If the work needs more than one repo, say which and why.
44
44
 
45
45
  ### Changes
@@ -66,11 +66,11 @@ One line for each Done when item, in the same order, saying how it will be shown
66
66
 
67
67
  ## 3. Stay inside the Specification
68
68
 
69
- Plan never edits the Specification or the original description. They are what John asked for, and the plan answers to them.
69
+ Plan never edits the Specification or the original description. They are what the human asked for, and the plan answers to them.
70
70
 
71
- - **A Done when item can't be met as written.** The code may show that an item is impossible, contradicts how the product works, or costs far more than the card suggests. Stop and ask John. He may change the Specification. You may not.
72
- - **A technical question.** Settle it from the code where you can. Ask John only what the code can't answer, such as an upcoming change that affects the approach, or a choice between two workable options with different costs. Ask one question at a time and give your recommendation.
73
- - **Something outside the Specification.** While reading you may find a nearby bug, a missing test or a refactor that would help. Leave it out of the plan and tell John when you finish. Folding it in makes the card bigger than what he approved.
71
+ - **A Done when item can't be met as written.** The code may show that an item is impossible, contradicts how the product works, or costs far more than the card suggests. Ask the human before going any further, in a handoff block with `status: needs-human`. They may change the Specification. You may not.
72
+ - **A technical question.** Settle it from the code where you can. Ask the human only what the code can't answer, such as an upcoming change that affects the approach, or a choice between two workable options with different costs. Ask one question at a time, in a handoff block with `status: needs-human` and your recommendation first in `options`.
73
+ - **Something outside the Specification.** While reading you may find a nearby bug, a missing test or a refactor that would help. Leave it out of the plan and put it in `flags` when you hand off. Folding it in makes the card bigger than what they approved.
74
74
 
75
75
  ## 4. Write it to the card
76
76
 
@@ -96,31 +96,60 @@ Use this form:
96
96
 
97
97
  After writing, read the card back. Check that the description and Specification are unchanged and that the Plan shows as a collapsed section.
98
98
 
99
- ## 5. Finish
99
+ ## 5. Hand off
100
100
 
101
- Tell John in a few lines:
101
+ When the Plan is on the card and you have read it back, write the handoff block. Plan is not finished until it is written:
102
102
 
103
- - The approach in one sentence.
104
- - Roughly how much it touches: how many files, in which apps or repos.
105
- - Whether it looks like one pull request's worth or more. Breakdown decides, but your read is useful.
106
- - Anything you found that sits outside the Specification.
103
+ - `phase: plan`, `status: done` and `next: breakdown`.
104
+ - `summary`: the approach in one sentence, roughly how much it touches (how many files, in which apps or repos), and whether it looks like one pull request's worth or more. Breakdown decides, but your read is useful.
105
+ - `flags`: anything you found that sits outside the Specification.
107
106
 
108
- Then stop. Breakdown is the next step.
107
+ ## The handoff block
108
+
109
+ Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
110
+
111
+ Write one handoff block every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Write it even when you go straight on to another step, because the block is the record that this one ended. Put it in a code block, one value per line, as the last thing you write for this step:
112
+
113
+ ```
114
+ phase: <this step>
115
+ status: <done, needs-human or failed>
116
+ next: <the step that follows>
117
+ summary: <one to three sentences on what you did>
118
+ flags: <what the human should know but wasn't asked>
119
+ question: <one question>
120
+ options: <the answers you expect, your recommendation first, separated by " | ">
121
+ reason: <what went wrong, and what you already tried>
122
+ ```
123
+
124
+ Which lines you write depends on the status:
125
+
126
+ | Status | Use it when | Lines |
127
+ |---|---|---|
128
+ | `done` | This step's work is on the card and you have read it back | `phase`, `status`, `next`, `summary`, and `flags` if there are any |
129
+ | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
130
+ | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
131
+
132
+ - **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
133
+ - **`needs-human` is a pause, not an ending.** Wait for the answer, then carry on with this step. The step is over only at `done` or `failed`.
134
+ - **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
135
+ - **Keep the block short.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
136
+ - **After `done`, this step is over.** Write the block before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
137
+ - **After `failed`, change nothing more.** Leave the card as it is for the human.
109
138
 
110
139
  ## If something goes wrong
111
140
 
112
141
  | When this happens | Do this |
113
142
  |---|---|
114
- | The card ID doesn't resolve | Ask John for the ID. Don't pick a card because its title looks similar |
143
+ | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
115
144
  | The Linear tools aren't available | Stop and say so. Show the finished section in the session so the work isn't lost. Don't save it somewhere else and report the step as done |
116
145
  | A write to the card fails | Read the card before doing anything else. Retry once, and only if the section isn't there, so it can't be added twice |
117
- | The read-back shows that text above your section changed | Put it back from what you read at the start of this run, append your section again, and tell John |
118
- | The collapsed section shows as plain `>>>` text | Leave the content as it is and tell John. Don't keep reformatting it |
119
- | A repo named in `PROJECT.md` is missing, or the fetch fails | Tell John, and ask whether to plan from what is on disk |
120
- | You can't tell which repo the work belongs in | Ask John. Don't guess paths |
146
+ | The read-back shows that text above your section changed | Put it back from what you read at the start of this run, append your section again, and tell the human |
147
+ | The collapsed section shows as plain `>>>` text | Leave the content as it is and tell the human. Don't keep reformatting it |
148
+ | A repo named in `PROJECT.md` is missing, or the fetch fails | Tell the human, and ask whether to plan from what is on disk |
149
+ | You can't tell which repo the work belongs in | Ask the human. Don't guess paths |
121
150
  | A path you were about to write doesn't exist | Find the real one, or mark the file as new. Never leave a path you haven't checked |
122
151
 
123
- If something fails that isn't on this list, stop and tell John what happened. Don't work around it.
152
+ If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
124
153
 
125
154
  ## Example
126
155