@johngaynor/ocnus 2.0.1-next.0 → 2.0.1-next.9

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,11 +16,11 @@ Six skills do the work, one for each step an agent runs, and a seventh,
16
16
  |---|---|
17
17
  | `sdlc-define` | The define step: sets a card's type and writes its Specification |
18
18
  | `sdlc-plan` | The plan step: reads the card and the code, and writes the Plan |
19
- | `sdlc-breakdown` | The breakdown step: decides whether the card is one piece or several slices, then asks you to approve it, unless you have turned that approval off |
19
+ | `sdlc-breakdown` | The breakdown step: decides whether the card is one piece or several slices, then asks you to approve it, unless you have turned that approval off, and once it is approved records in Linear the other cards it waits on, and the cards in Todo that wait on it |
20
20
  | `sdlc-build` | The build step: builds an approved card in its task, making the change the Plan describes, running the tests and committing, pushing nothing |
21
21
  | `sdlc-review` | The review step: checks the build step's work against the card's Done when, writes what it found on the card as its Review, and sends what is not met back to the build step |
22
22
  | `sdlc-pr` | The pr step: pushes a reviewed card's branch, opens its pull requests, moves the card to In Review and waits while you merge them, running no watch of its own: ocnus's watch records the merge and finishes the task. It never merges |
23
- | `brief` | Not a step: a catch-up on the session, in no more than five lines and three parts: the original task, what has happened so far, and what the agent is working on right now. In a session ocnus started for a card, it reads the card, with its parent card and Linear project, `task log` and the branch's commits. Say "brief" or `/brief` in any Claude Code session for one. It records nothing, is never an answer to a question, and never stops a run |
23
+ | `brief` | Not a step: a catch-up on the session, in no more than five lines and three parts: the original task, what has happened so far, and what the agent is working on right now. In a session ocnus started for a card, it reads the card, with its parent card and Linear project, `task log` and the branch's commits. For a slice it reads the parent card too, and gives the card's place among its slices, as slice 2 of 4, and which of them have shipped; for a card with slices of its own, which of those have. Say "brief" or `/brief` in any Claude Code session for one. It records nothing, is never an answer to a question, and never stops a run |
24
24
 
25
25
  They live in [skills/](skills/). `ocnus install` links them into
26
26
  `~/.claude/skills`, so any Claude Code session on the machine can run one by
@@ -336,7 +336,9 @@ else. This needs `jq`; without it Claude Code asks once.
336
336
 
337
337
  A task is one piece of work in a space, usually a Linear card. Two commands
338
338
  make it, in this order: `task new`, then `task start`, which the write-up phase
339
- runs once you approve the card, unless you hold it for later.
339
+ runs as soon as you approve the card: approving a card starts it. A card you
340
+ want to hold, leave unapproved. A card that another card blocks waits by
341
+ itself: `task start` holds it until every card that blocks it is done.
340
342
 
341
343
  To see which cards there are first, `task ls` lists the open cards of the
342
344
  space's Linear teams, under their statuses:
@@ -354,9 +356,9 @@ lists a key Linear rejects as a problem, which makes `status` exit non-zero.
354
356
  For a key that works, it also checks whether the key can change cards, by
355
357
  asking Linear to change a card that cannot exist, which changes nothing. A
356
358
  key with Read permission alone lists cards, so `task ls` and the Cards panel
357
- work with it, but `linear type`, `linear section`, `linear slices` and
358
- `linear move` fail with it, and the card skills fall back to the agent's own
359
- Linear tools.
359
+ work with it, but `linear type`, `linear section`, `linear slices`,
360
+ `linear block` and `linear move` fail with it, and the card skills fall
361
+ back to the agent's own Linear tools.
360
362
  `status` lists such a key as a problem too, and exits non-zero. `linear key`
361
363
  checks the same before it saves a key: it saves one that cannot change cards,
362
364
  then says so. Either way, the fix is a key with Write permission, saved with
@@ -383,12 +385,23 @@ running, `task new` starts it, without the variables of a Claude Code session
383
385
  it was run from, so that a `claude` in its terminals still saves its
384
386
  transcript. See [herdr/README.md](herdr/README.md#writing-the-card-up).
385
387
 
388
+ Before it asks you to approve, breakdown looks for the cards this one waits
389
+ on: every other card that the card, or one of its slices, needs merged
390
+ first, a slice of another card too, and any card already approved and in
391
+ Todo that needs this one first. The Breakdown and the summary you approve
392
+ from name them. Nothing is recorded before you approve. Once you do, the
393
+ agent records them in Linear with `ocnus linear block`, before `task start`
394
+ runs: each blocker on the card, or on the slice it blocks, and this card as
395
+ a blocker of each card in Todo that needs it, so that one is not started
396
+ first. `ocnus linear read <card>` shows the cards that block a card and
397
+ the cards it blocks, each with its status.
398
+
386
399
  Recording your approval moves the card in Linear to its team's first
387
400
  not-started status (Todo in Lab), and each of its sub-issues with it. When a
388
401
  card cannot be moved, the approval is still recorded, and the agent tells you
389
402
  which card, and why. `task log` shows that too, under the approval's row.
390
- Then the agent starts the build phase with `task start`, unless you hold it
391
- for later. The approval itself closes nothing: the write-up session stays
403
+ Then the agent starts the build phase with `task start`. The approval itself
404
+ closes nothing: the write-up session stays
392
405
  open until `task start` has opened the build tab, which then puts it away
393
406
  (see below).
394
407
 
@@ -397,7 +410,7 @@ With the breakdown approval off (`ocnus approval --breakdown off`, see
397
410
  approve a card it has no doubt about: the setting approves it. It writes the
398
411
  Breakdown, makes the sub-issues when the card is sliced, records the
399
412
  approval, which moves the card as yours does and says the setting gave it,
400
- and runs `task start` itself, as for an approval to start now. A card it
413
+ and runs `task start` itself, as for your approval. A card it
401
414
  has a doubt about still waits for you, with the doubt in the summary: one
402
415
  it thinks too big, one that looks like several cards, or a sub-issue that
403
416
  looks too big to stay one piece. So do the questions define
@@ -458,8 +471,7 @@ before.
458
471
  `task start` starts the work, once you have approved the card. It takes the
459
472
  card too, makes a branch and a git worktree of it in every repo of the
460
473
  space, opens a tab for it, and starts the agent there that runs the build
461
- phase. The write-up phase runs it once you approve the card, or gives it to
462
- you when you chose to start later:
474
+ phase. The write-up phase runs it as soon as you approve the card:
463
475
 
464
476
  ```sh
465
477
  ocnus task start my-space ABC-122
@@ -474,6 +486,13 @@ as a tab named after the task. When herdr-core is not running,
474
486
  start, it stops before it makes anything. See
475
487
  [herdr/README.md](herdr/README.md#starting-the-work).
476
488
 
489
+ `task start` holds a card while a card that blocks it, or the card it was
490
+ sliced from, is not done yet in Linear. It makes no branch, worktree or tab,
491
+ leaves the card in Todo, names each card that holds it, with its status, and
492
+ exits non-zero. Run it again once those cards are done. When Linear is not
493
+ asked, as when the card's type and title are given with no key saved, it
494
+ starts the card with a note that its blockers were not checked.
495
+
477
496
  Once the build tab is open, `task start` puts the card's write-up session
478
497
  away, so finished write-up sessions do not pile up. For a sub-issue it is the
479
498
  session of the card it was sliced from, whose tab it was written up in. It
@@ -483,16 +502,17 @@ starts `task close` for that card in herdr-core, detached, with no tab:
483
502
  ocnus task close my-space ABC-122
484
503
  ```
485
504
 
486
- `task close` waits for the write-up agent's turn to end, which with start now
487
- is the turn in which it ran `task start`. Then it ends the agent's Claude session with `/exit`, waits
505
+ `task close` waits for the write-up agent's turn to end, which is the turn in
506
+ which it ran `task start`. Then it ends the agent's Claude session with `/exit`, waits
488
507
  for the tab's shell to come back, and closes the tab, or with the Herdr app
489
508
  closed ends its terminal in herdr-core, so opening the app later shows no tab
490
509
  for it. The clean exit is what archives the session in the Claude app's list
491
510
  of sessions, with Remote Control on. Its transcript stays, so
492
511
  `claude --resume` still opens it. A live agent is never killed: when it has
493
512
  not exited 30 seconds after `/exit`, or the tab runs a program that reports
494
- no status, the tab is left open. With start later, the write-up session stays
495
- open until you run `task start`, from any terminal. When `task start` stops,
513
+ no status, the tab is left open. When `task start` holds the card, the
514
+ write-up session stays open until you run `task start` again, from any
515
+ terminal, once the cards that hold it are done. When `task start` stops,
496
516
  before it has made the task or without opening its tab, the write-up session
497
517
  stays open. Only the card's own write-up tab is closed: the build tab, other
498
518
  cards' write-up tabs and the terminal `task start` ran in stay open, and a
@@ -5,7 +5,7 @@
5
5
  # approved (skills/sdlc-breakdown). With the breakdown approval on, it asks
6
6
  # the human and waits for the answer. That is the default. With it off, it
7
7
  # approves a card it has no doubt about by itself and runs `task start`, as
8
- # for an approval to start now, without asking; a card it has a doubt about,
8
+ # for the human's approval, without asking; a card it has a doubt about,
9
9
  # such as one it thinks too big, still waits for the human. The choice is
10
10
  # "approval": {"breakdown": true|false} in the settings file (settings.sh),
11
11
  # an object so that a later approval gets a key beside it, and on when the
@@ -23,7 +23,7 @@ HANDOFF_KEYS='step status next summary flags approved question options answer re
23
23
  # start (record_start). Breakdown hands on to it once the human approves the
24
24
  # card, or the setting does, but it is only ever what comes next in a block, since it is a command
25
25
  # that records its own row, not a skill: the write-up agent runs it, or the
26
- # human does when they hold the build phase for later. A review that finds the work done hands on to pr, the step that pushes
26
+ # human does again once it has held a card for a card that blocks it. A review that finds the work done hands on to pr, the step that pushes
27
27
  # the task's branch, opens its pull requests and waits for the human to merge
28
28
  # them. merged is where a card ends: pr hands on to it once every pull request
29
29
  # has merged. It too is only ever what comes next, since nothing runs after it.
package/cli/lib/linear.sh CHANGED
@@ -169,7 +169,7 @@ WRITE_QUERY='mutation { issueUpdate(id: "00000000-0000-0000-0000-000000000000",
169
169
 
170
170
  # What is said of a key that can read cards but not change them, by `status`
171
171
  # as a problem and by `linear key` once it has saved such a key.
172
- NO_WRITE_WHY="The key can read cards but not change them, so linear type, linear section, linear slices and linear move fail with it. Make a key with Write permission in $KEY_PLACE, then save it with: ocnus linear key"
172
+ NO_WRITE_WHY="The key can read cards but not change them, so linear type, linear section, linear slices, linear block and linear move fail with it. Make a key with Write permission in $KEY_PLACE, then save it with: ocnus linear key"
173
173
 
174
174
  # How Linear's answer to WRITE_QUERY reads, as one word and what follows it:
175
175
  # cannot a refusal: an error of type or code forbidden, or one whose
@@ -332,34 +332,62 @@ linear_open_cards() {
332
332
  printf '%s' "$list" | jq -c 'del(.missing)'
333
333
  }
334
334
 
335
+ # How many of a card's relations, and of its parent's, the card's question
336
+ # reads, to find the cards that block it. A card with more than that has
337
+ # blockers that were not read, which CARD_SHAPE says.
338
+ CARD_RELATIONS=50
339
+ # A card's relations of every kind that name it as the related card. Those of
340
+ # the kind "blocks" name a card that blocks it, its blocker, as their issue.
341
+ CARD_BLOCKERS_READ='inverseRelations(first: '$CARD_RELATIONS') {
342
+ nodes { type issue { identifier state { name type } } } pageInfo { hasNextPage } }'
335
343
  # Find a card by its team's key and its number, as Linear keeps them: ABC-122
336
- # is team ABC, number 122. Its title, its labels and the card it was sliced
337
- # from, its parent, come with it.
344
+ # is team ABC, number 122. Its title, its status, its labels, the card it was
345
+ # sliced from, its parent, and the cards that block either of them, come with
346
+ # it.
338
347
  CARD_QUERY='query($team: String!, $number: Float!) {
339
348
  issues(first: 1, filter: {team: {key: {eq: $team}}, number: {eq: $number}}) {
340
- nodes { identifier title labels { nodes { name parent { name } } } parent { identifier } }
349
+ nodes { identifier title state { name } labels { nodes { name parent { name } } }
350
+ '$CARD_BLOCKERS_READ'
351
+ parent { identifier
352
+ '$CARD_BLOCKERS_READ' } }
341
353
  }
342
354
  }'
343
355
  # The label group a card's type is in. sdlc-define sets the type there.
344
356
  TYPE_GROUP=Type
345
- # Turn Linear's answer to CARD_QUERY into the card, {id, title, type,
346
- # parent}, or "none" when Linear has no such card. type is null when the card
347
- # has no label in the Type group ($group), and parent, the parent's ID, when
348
- # it has no parent. An answer with no list of cards in it is not Linear
349
- # saying it has none, so it is an error.
357
+ # Turn Linear's answer to CARD_QUERY into the card, {id, title, type, parent,
358
+ # status, blockers, blockersCut}, or "none" when Linear has no such card. type
359
+ # is null when the card has no label in the Type group ($group), parent, the
360
+ # parent's ID, when it has no parent, and status, the name of its status,
361
+ # when the answer has none. blockers are the cards that block it and those
362
+ # that block its parent, each as {id, status, type, of}: its ID, the name and
363
+ # kind of its status (completed for a card that is done), and the ID of the
364
+ # card it blocks. blockersCut is true when the card or its parent has more
365
+ # relations than were read, so that blockers may not be all of them. An
366
+ # answer with no list of cards in it is not Linear saying it has none, so it
367
+ # is an error.
350
368
  CARD_SHAPE='
369
+ def blockers: (.identifier? | strings) as $of
370
+ | [.inverseRelations.nodes[]? | select(.type? == "blocks") | .issue
371
+ | select(.identifier? | strings)
372
+ | {id: .identifier, status: ((.state.name? | strings) // ""), type: ((.state.type? | strings) // ""), of: $of}];
373
+ def cut: .inverseRelations.pageInfo.hasNextPage? == true;
351
374
  if (.issues.nodes | type) != "array" then error("no list of cards")
352
375
  elif (.issues.nodes | length) == 0 then "none"
353
376
  else .issues.nodes[0]
354
377
  | {id: .identifier, title: (.title // ""),
355
378
  type: ([.labels.nodes[]? | select(.parent.name? == $group) | .name] | first),
356
- parent: ((.parent.identifier? | strings) // null)}
379
+ parent: ((.parent.identifier? | strings) // null),
380
+ status: ((.state.name? | strings) // null),
381
+ blockers: (blockers + (if (.parent | type) == "object" then (.parent | blockers) else [] end)),
382
+ blockersCut: (cut or ((.parent | type) == "object" and (.parent | cut)))}
357
383
  end'
358
384
 
359
385
  # Print one card as one line of JSON, or stop and say why:
360
- # {"id":"ABC-122","title":"Export orders as CSV","type":"feat","parent":"ABC-100"}
361
- # type is null when the card has no label in the Type group, and parent when
362
- # it has no parent.
386
+ # {"id":"ABC-122","title":"Export orders as CSV","type":"feat","parent":"ABC-100","status":"Todo",
387
+ # "blockers":[{"id":"ABC-121","status":"In Progress","type":"started","of":"ABC-122"}],"blockersCut":false}
388
+ # type is null when the card has no label in the Type group, parent when it
389
+ # has no parent, and status when Linear did not say it. blockers are the
390
+ # cards that block it or its parent, done or not (CARD_SHAPE).
363
391
  # linear_card <card ID, in upper case>
364
392
  linear_card() {
365
393
  local card=$1 key vars data found
@@ -466,14 +494,18 @@ linear_key() {
466
494
  # it. `task ls` uses it too.
467
495
  PLAIN_DEF='def plain: explode | map(if . < 32 or (. > 126 and . < 160) then 32 else . end) | implode;'
468
496
 
469
- # How many labels, comments and sub-issues a read asks Linear for. A card
470
- # with more than that is not printed, since what was read would pass for the
471
- # whole of it.
497
+ # How many labels, comments, sub-issues and relations a read asks Linear
498
+ # for. A card with more than that is not printed, since what was read would
499
+ # pass for the whole of it. The relations are asked for each way: those from
500
+ # the card to another card, and those from another card to it.
472
501
  READ_LABELS=100
473
502
  READ_COMMENTS=100
474
503
  READ_SUBS=50
504
+ READ_RELATIONS=50
475
505
 
476
- # The question for linear read: the card whole.
506
+ # The question for linear read: the card whole. Its relations of the kind
507
+ # "blocks" name the cards it blocks, as their relatedIssue, and its inverse
508
+ # relations of that kind the cards that block it, as their issue.
477
509
  READ_QUERY='query($team: String!, $number: Float!) {
478
510
  issues(first: 1, filter: {team: {key: {eq: $team}}, number: {eq: $number}}) {
479
511
  nodes {
@@ -483,27 +515,39 @@ READ_QUERY='query($team: String!, $number: Float!) {
483
515
  parent { identifier title }
484
516
  project { name }
485
517
  comments(first: '$READ_COMMENTS') { nodes { body createdAt user { name } botActor { name } } pageInfo { hasNextPage } }
486
- children(first: '$READ_SUBS') { nodes { identifier title state { name type } } pageInfo { hasNextPage } }
518
+ children(first: '$READ_SUBS') { nodes { identifier title createdAt state { name type } } pageInfo { hasNextPage } }
519
+ relations(first: '$READ_RELATIONS') { nodes { type relatedIssue { identifier title state { name type } } } pageInfo { hasNextPage } }
520
+ inverseRelations(first: '$READ_RELATIONS') { nodes { type issue { identifier title state { name type } } } pageInfo { hasNextPage } }
487
521
  }
488
522
  }
489
523
  }'
490
524
 
491
525
  # From the answer to READ_QUERY, on stdin, print "none" when Linear has no
492
- # such card, {"more": <what>} when it has more comments, sub-issues or labels
493
- # than were asked for, or {"card": <the card>}, the card as linear read --json
494
- # prints it. A comment's author is the app Linear credits with it, or else
495
- # the user who wrote it. Comments come oldest first. An answer with a card in
496
- # it that is not in this form did not come from Linear. $group is TYPE_GROUP.
526
+ # such card, {"more": <what>} when it has more comments, sub-issues, labels
527
+ # or relations than were asked for, or {"card": <the card>}, the card as
528
+ # linear read --json prints it. A comment's author is the app Linear credits
529
+ # with it, or else the user who wrote it. Comments come oldest first, and so
530
+ # do sub-issues, in the order they were made, which is the order linear
531
+ # slices makes a card's slices in, whatever order Linear lists them in; when
532
+ # each was made is left out. blockedBy are the cards that block it and blocks
533
+ # the cards it blocks, from its relations of the kind "blocks" alone, done or
534
+ # not, each as a sub-issue is, in the order Linear lists them. An answer with
535
+ # a card in it that is not in this form did not come from Linear. $group is
536
+ # TYPE_GROUP.
497
537
  READ_SHAPE='
498
538
  def text: if type == "string" then . else error("unreadable") end;
499
539
  def list: if (.nodes | type) == "array" then .nodes[] else error("unreadable") end;
500
540
  def status: if type == "object" then {name: (.name | text), type: (.type | text)} else error("unreadable") end;
541
+ def other: if type == "object" then {id: (.identifier | text), title: (.title | text), status: (.state | status)}
542
+ else error("unreadable") end;
501
543
  if (.issues.nodes | type) != "array" then error("no list of cards")
502
544
  elif (.issues.nodes | length) == 0 then "none"
503
545
  else .issues.nodes[0]
504
546
  | if .comments.pageInfo.hasNextPage? == true then {more: "comments"}
505
547
  elif .children.pageInfo.hasNextPage? == true then {more: "sub-issues"}
506
548
  elif .labels.pageInfo.hasNextPage? == true then {more: "labels"}
549
+ elif .relations.pageInfo.hasNextPage? == true or .inverseRelations.pageInfo.hasNextPage? == true
550
+ then {more: "relations"}
507
551
  else {card: {
508
552
  id: (.identifier | text),
509
553
  title: (.title | text),
@@ -512,17 +556,22 @@ READ_SHAPE='
512
556
  type: ([.labels | list | select(.parent.name? == $group) | .name] | first),
513
557
  labels: [.labels | list | .name | text],
514
558
  parent: (if .parent == null then null else {id: (.parent.identifier | text), title: (.parent.title | text)} end),
559
+ blockedBy: [.inverseRelations | list | select((.type | text) == "blocks") | .issue | other],
560
+ blocks: [.relations | list | select((.type | text) == "blocks") | .relatedIssue | other],
515
561
  project: (if .project == null then null else {name: (.project.name | text)} end),
516
562
  description: (.description // "" | text),
517
563
  comments: ([.comments | list
518
564
  | {author: (.botActor.name? // .user.name? // "unknown" | text),
519
565
  createdAt: (.createdAt | text), body: (.body // "" | text)}] | sort_by(.createdAt)),
520
- subIssues: [.children | list | {id: (.identifier | text), title: (.title | text), status: (.state | status)}]
566
+ subIssues: ([.children | list
567
+ | {id: (.identifier | text), title: (.title | text), status: (.state | status),
568
+ createdAt: (.createdAt | text)}] | sort_by(.createdAt) | map(del(.createdAt)))
521
569
  }}
522
570
  end
523
571
  end'
524
572
 
525
- # The card from READ_SHAPE, on stdin, laid out like the card: its head, the
573
+ # The card from READ_SHAPE, on stdin, laid out like the card: its head, with
574
+ # a line for each card that blocks it and each card it blocks, the
526
575
  # description as written, the comments, each with its body indented under who
527
576
  # wrote it and when, and the sub-issues. Every field is made plain, but the
528
577
  # description and the comments keep their line breaks, without the \r Linear
@@ -536,6 +585,8 @@ READ_TEXT=$PLAIN_DEF'
536
585
  "Status: \(.status.name | plain)",
537
586
  "Labels: \(if .labels == [] then "none" else .labels | map(plain) | join(", ") end)",
538
587
  (.parent // empty | "Parent: \(.id | plain) \(.title | plain)"),
588
+ (.blockedBy[] | "Blocked by: \(.id | plain) \(.status.name | plain) \(.title | plain)"),
589
+ (.blocks[] | "Blocks: \(.id | plain) \(.status.name | plain) \(.title | plain)"),
539
590
  (.project // empty | "Project: \(.name | plain)"),
540
591
  "URL: \(.url | plain)",
541
592
  "",
@@ -552,13 +603,17 @@ READ_TEXT=$PLAIN_DEF'
552
603
  # Print a card whole, laid out like the card, or with --json as one line of
553
604
  # JSON, for a mod:
554
605
  # {"id":"ABC-122","title":"…","url":"…","status":{"name":"In Progress","type":"started"},
555
- # "type":"feat","labels":["feat"],"parent":{"id":"ABC-100","title":"…"},"project":{"name":"…"},
606
+ # "type":"feat","labels":["feat"],"parent":{"id":"ABC-100","title":"…"},
607
+ # "blockedBy":[{"id":"ABC-121","title":"…","status":{"name":"In Progress","type":"started"}}],
608
+ # "blocks":[{"id":"ABC-130","title":"…","status":{"name":"Todo","type":"unstarted"}}],
609
+ # "project":{"name":"…"},
556
610
  # "description":"…",
557
611
  # "comments":[{"author":"…","createdAt":"…","body":"…"}],
558
612
  # "subIssues":[{"id":"ABC-123","title":"…","status":{"name":"Todo","type":"unstarted"}}]}
559
613
  # type is the card's label in the Type group, or null; parent and project, the
560
- # card's Linear project, are null for a card with none. When it fails it
561
- # prints nothing on stdout.
614
+ # card's Linear project, are null for a card with none. blockedBy are the
615
+ # cards that block it, and blocks the cards it blocks, done or not. When it
616
+ # fails it prints nothing on stdout.
562
617
  # ocnus linear read <card> [--json]
563
618
  linear_read() {
564
619
  local card=${1:-} json=0 key vars data shape more=''
@@ -584,6 +639,7 @@ linear_read() {
584
639
  '{"more":"comments"}') more="$READ_COMMENTS comments" ;;
585
640
  '{"more":"sub-issues"}') more="$READ_SUBS sub-issues" ;;
586
641
  '{"more":"labels"}') more="$READ_LABELS labels" ;;
642
+ '{"more":"relations"}') more="$READ_RELATIONS relations" ;;
587
643
  *) die "Linear's answer was not one ocnus can read. Something between this machine and Linear may be answering for it." ;;
588
644
  esac
589
645
  [ -z "$more" ] ||
@@ -597,11 +653,12 @@ linear_read() {
597
653
 
598
654
  # --- the card skills' writes ------------------------------------------------
599
655
  #
600
- # The card skills write three things: a card's type label, a section of its
601
- # description, and its slices, the sub-issues sdlc-breakdown makes of it. Each
602
- # is one command here, so that it goes the same way on every run, and each
603
- # reads back what Linear saved before it says it is done. The slices are the
604
- # one thing created; nothing else in Linear is changed.
656
+ # The card skills write four things: a card's type label, a section of its
657
+ # description, its slices, the sub-issues sdlc-breakdown makes of it, and the
658
+ # cards that block a card. Each is one command here, so that it goes the same
659
+ # way on every run, and each reads back what Linear saved before it says it
660
+ # is done. The slices and the blockers are the only things created; nothing
661
+ # else in Linear is changed, and nothing is removed.
605
662
 
606
663
  # The types a card can have. Each is the start of the card's branch name.
607
664
  CARD_TYPES='feat fix chore'
@@ -1083,6 +1140,114 @@ linear_slices() {
1083
1140
  .others[] | "Left alone: \(.identifier | plain) \(.title | plain), a sub-issue of \($card) that is not one of its slices"'
1084
1141
  }
1085
1142
 
1143
+ # --- recording blockers -----------------------------------------------------
1144
+ #
1145
+ # sdlc-breakdown records every other card a card or a slice depends on, in
1146
+ # another parent card too, as one that blocks it, so that the cards start in
1147
+ # the order the work needs: `task start` holds a card while a card that
1148
+ # blocks it is not done. A blocker is a relation of the kind "blocks", from
1149
+ # the blocker to the card, as linear slices makes between slices. Nothing
1150
+ # here ever removes one.
1151
+
1152
+ # The question for linear block: a card's id, and the cards that block it
1153
+ # now, by their ids. It finds each blocker's id too. A card with more
1154
+ # relations than are read may have a blocker among the rest; asking for it
1155
+ # again costs nothing, since Linear keeps one relation of a kind between two
1156
+ # cards (SLICE_RELATIONS).
1157
+ BLOCK_QUERY='query($team: String!, $number: Float!) {
1158
+ issues(first: 1, filter: {team: {key: {eq: $team}}, number: {eq: $number}}) {
1159
+ nodes { id identifier
1160
+ inverseRelations(first: '$CARD_RELATIONS') { nodes { type issue { id } } } }
1161
+ }
1162
+ }'
1163
+
1164
+ # From the answer to BLOCK_QUERY, on stdin, the card as {"state": "ok", id,
1165
+ # blockers}, blockers being the ids of the cards that block it, or
1166
+ # {"state": "none"} when Linear has no such card. An answer with a card in it
1167
+ # that is not in this form did not come from Linear.
1168
+ BLOCK_SHAPE='
1169
+ def text: if type == "string" then . else error("unreadable") end;
1170
+ if (.issues.nodes | type) != "array" then error("no list of cards")
1171
+ elif (.issues.nodes | length) == 0 then {state: "none"}
1172
+ else .issues.nodes[0]
1173
+ | {state: "ok", id: (.id | text),
1174
+ blockers: [.inverseRelations.nodes[]? | select(.type? == "blocks") | .issue.id? | strings]}
1175
+ end'
1176
+
1177
+ # Print a card as BLOCK_SHAPE has it, one line of JSON, or stop and say why.
1178
+ # block_card <key> <card ID, in upper case>
1179
+ block_card() {
1180
+ local key=$1 card=$2 vars data found
1181
+ vars=$(jq -cn --arg team "${card%-*}" --arg number "${card##*-}" '{team: $team, number: ($number | tonumber)}') ||
1182
+ die "'$card' is not a card ID like ABC-122. Nothing was recorded."
1183
+ data=$(linear_ask "$key" "$BLOCK_QUERY" "$vars") || exit 1
1184
+ # Judged by what jq prints: some versions exit zero on an empty answer.
1185
+ found=$(printf '%s' "$data" | jq -c "$BLOCK_SHAPE" 2>/dev/null) || found=
1186
+ case $(printf '%s' "$found" | jq -r '.state' 2>/dev/null) in
1187
+ ok) printf '%s\n' "$found" ;;
1188
+ none) die "Linear has no card $card that the saved key can see. Check the ID, then run this again. Nothing was recorded." ;;
1189
+ *) die "Linear's answer was not one ocnus can read. Something between this machine and Linear may be answering for it. Nothing was recorded." ;;
1190
+ esac
1191
+ }
1192
+
1193
+ # Record in Linear that each blocker given blocks the card: a relation of the
1194
+ # kind blocks, from the blocker to the card. Every card is read before
1195
+ # anything is recorded, so an ID Linear does not have records nothing. A
1196
+ # blocker the card has already is skipped, one given twice is recorded once,
1197
+ # and each one recorded is read back before the next. A card never blocks
1198
+ # itself. Nothing is removed. It prints one line for each blocker:
1199
+ # <card> is now blocked by <blocker>
1200
+ # <card> is blocked by <blocker> already
1201
+ # A run that stopped partway is finished by running it again with the same
1202
+ # cards.
1203
+ # ocnus linear block <card> <blocker>...
1204
+ linear_block() {
1205
+ local card=${1:-} given blocker blockers='' key found card_id had ids='' id vars made
1206
+ [ "$#" -ge 2 ] ||
1207
+ die "usage: ocnus linear block <card> <blocker>..., like: ocnus linear block ABC-122 ABC-121, which records that ABC-121 blocks ABC-122"
1208
+ [[ $card =~ $CARD_RE ]] || die "'$card' is not a card ID like ABC-122. Nothing was recorded."
1209
+ card=$(printf '%s' "$card" | tr '[:lower:]' '[:upper:]')
1210
+ shift
1211
+ for given in "$@"; do
1212
+ [[ $given =~ $CARD_RE ]] || die "'$given' is not a card ID like ABC-121. Nothing was recorded."
1213
+ blocker=$(printf '%s' "$given" | tr '[:lower:]' '[:upper:]')
1214
+ [ "$blocker" != "$card" ] || die "$card cannot block itself. Nothing was recorded."
1215
+ in_list "$blocker" "$blockers" || blockers="$blockers $blocker"
1216
+ done
1217
+ linear_tools
1218
+ key=$(linear_saved_key) || exit 1
1219
+ found=$(block_card "$key" "$card") || exit 1
1220
+ card_id=$(printf '%s' "$found" | jq -r '.id')
1221
+ had=$(printf '%s' "$found" | jq -r '.blockers[]')
1222
+ # Each blocker's id, in the order given, before anything is recorded.
1223
+ for blocker in $blockers; do
1224
+ found=$(block_card "$key" "$blocker") || exit 1
1225
+ id=$(printf '%s' "$found" | jq -r '.id')
1226
+ [ "$id" != "$card_id" ] || die "$blocker is $card in Linear, and $card cannot block itself. Nothing was recorded."
1227
+ ids="$ids $id"
1228
+ done
1229
+ # The ids are Linear's, with no spaces in them, one for each blocker, in
1230
+ # the same order.
1231
+ # shellcheck disable=SC2086
1232
+ set -- $ids
1233
+ for blocker in $blockers; do
1234
+ id=$1
1235
+ shift
1236
+ if printf '%s\n' "$had" | grep -qxF -- "$id"; then
1237
+ say "$card is blocked by $blocker already"
1238
+ continue
1239
+ fi
1240
+ vars=$(jq -cn --arg from "$id" --arg to "$card_id" '{input: {issueId: $from, relatedIssueId: $to, type: "blocks"}}')
1241
+ made=$(linear_ask "$key" "$SLICE_BLOCK" "$vars" 2>&1) ||
1242
+ die "could not record $blocker as blocking $card: $(first_sentence "$made"). Run this again with the same cards to record the rest: it skips the blockers already there."
1243
+ [ "$(printf '%s' "$made" | jq -r --arg from "$id" --arg to "$card_id" '
1244
+ .issueRelationCreate.issueRelation | type == "object" and .type? == "blocks"
1245
+ and .issue.id? == $from and .relatedIssue.id? == $to' 2>/dev/null)" = true ] ||
1246
+ die "Linear did not record $blocker as blocking $card, as its answer shows. Look at $card in Linear, then run this again with the same cards to add it."
1247
+ say "$card is now blocked by $blocker"
1248
+ done
1249
+ }
1250
+
1086
1251
  # --- moving a card ----------------------------------------------------------
1087
1252
  #
1088
1253
  # ocnus moves a card at four points: the hand-off that records the
@@ -1381,9 +1546,10 @@ cmd_linear() {
1381
1546
  type) shift; linear_type "$@" ;;
1382
1547
  section) shift; linear_section "$@" ;;
1383
1548
  slices) shift; linear_slices "$@" ;;
1549
+ block) shift; linear_block "$@" ;;
1384
1550
  move) shift; linear_move_cmd "$@" ;;
1385
1551
  read) shift; linear_read "$@" ;;
1386
1552
  archive) shift; linear_archive_cmd "$@" ;;
1387
- *) die "usage: ocnus linear key, or: ocnus linear read <card> [--json], or: ocnus linear type <card> <feat|fix|chore>, or: ocnus linear section <card> <Specification|Plan|Breakdown|Review> [--replace], or: ocnus linear slices <card>, or: ocnus linear move <card> <approved|started|review|done>, or: ocnus linear archive [on|off|--json] (see: ocnus help)" ;;
1553
+ *) die "usage: ocnus linear key, or: ocnus linear read <card> [--json], or: ocnus linear type <card> <feat|fix|chore>, or: ocnus linear section <card> <Specification|Plan|Breakdown|Review> [--replace], or: ocnus linear slices <card>, or: ocnus linear block <card> <blocker>..., or: ocnus linear move <card> <approved|started|review|done>, or: ocnus linear archive [on|off|--json] (see: ocnus help)" ;;
1388
1554
  esac
1389
1555
  }
package/cli/lib/task.sh CHANGED
@@ -6,8 +6,9 @@
6
6
  # task new an agent writes the card up, in a tab in the space
7
7
  # task start a worktree of each repo on the card's branch, in a tab of its
8
8
  # own, which runs `task build` to start the agent that builds
9
- # the card. The write-up agent runs it once the human approves
10
- # the card, unless they hold it; then they run it.
9
+ # the card. The write-up agent runs it as soon as the card is
10
+ # approved. It makes nothing for a card that a card not done
11
+ # yet blocks, and the human runs it again once that is done.
11
12
  # The agent runs `task handoff` as each step ends, and `task log` shows what
12
13
  # it recorded. Both are in handoff.sh. While the pull requests wait on the
13
14
  # human, `task merges`, ocnus's watch on the merges, watches them on
@@ -323,8 +324,12 @@ short_name() {
323
324
  # Name the branch a card's task is on, <type>/<card ID>-<short name>: like
324
325
  # feat/abc-122-export-orders-as-csv. It leaves the branch in BRANCH, in
325
326
  # BRANCH_NOTES what `task start` says about where the type and title came
326
- # from, and in CARD_PARENT the card it was sliced from, as Linear names it,
327
- # or nothing when it has none or Linear was not asked. It runs in the main
327
+ # from and whether the card's blockers were checked, in CARD_PARENT the card
328
+ # it was sliced from, as Linear names it, or nothing when it has none or
329
+ # Linear was not asked, and in CARD_STATUS the name of the card's status in
330
+ # Linear, or nothing. CARD_OPEN is the cards that block it or its parent and
331
+ # are not done yet, as a JSON list of {id, status, of} (CARD_SHAPE), or
332
+ # nothing when every one is done or Linear was not asked. It runs in the main
328
333
  # shell, not in $( ), so that it can leave them, and every stop is before
329
334
  # anything is made.
330
335
  # card_branch <space> <card ID, in upper case> [<type> <title>]
@@ -334,11 +339,12 @@ short_name() {
334
339
  # wins when it can be asked: Linear's type and title name the branch, by the
335
340
  # same checks, with a note for each given one that differs. With no key
336
341
  # saved, or a Linear that cannot be asked (a rejected key, no network, no
337
- # curl or jq), the given ones name it, with a note on why.
338
- BRANCH='' BRANCH_NOTES=() CARD_PARENT=''
342
+ # curl or jq), the given ones name it, with a note on why, and a note that
343
+ # the blockers were not checked.
344
+ BRANCH='' BRANCH_NOTES=() CARD_PARENT='' CARD_STATUS='' CARD_OPEN=''
339
345
  card_branch() {
340
346
  local name=$1 card=$2 given_type=${3:-} given_title=${4:-} found out rc=0 type title short branch parent
341
- BRANCH='' BRANCH_NOTES=() CARD_PARENT=''
347
+ BRANCH='' BRANCH_NOTES=() CARD_PARENT='' CARD_STATUS='' CARD_OPEN=''
342
348
  if [ -z "$given_type" ]; then
343
349
  [ -n "${LINEAR_API_KEY:-}" ] ||
344
350
  die "no Linear key is saved, so ocnus cannot read $card's type and title in Linear. Save a key with ocnus linear key (make one in $KEY_PLACE), or give the type and title: ocnus task start $name $card --type <type> --title '<title>'"
@@ -367,6 +373,15 @@ card_branch() {
367
373
  # Only a card ID: it is looked for among the space's tabs.
368
374
  parent=$(printf '%s' "$found" | jq -r '.parent // empty')
369
375
  [[ ! $parent =~ $CARD_RE ]] || CARD_PARENT=$(printf '%s' "$parent" | tr '[:lower:]' '[:upper:]')
376
+ # Linear's text, made plain, as task ls makes it, for task start to say.
377
+ CARD_STATUS=$(printf '%s' "$found" | jq -r "$PLAIN_DEF"' .status // empty | plain')
378
+ # A blocker not done yet holds the card. One that is done holds nothing.
379
+ CARD_OPEN=$(printf '%s' "$found" |
380
+ jq -c "$PLAIN_DEF"' [.blockers[]? | select(.type != "completed")
381
+ | {id: (.id | plain), status: (.status | plain), of: (.of | plain)}] | select(length > 0)')
382
+ if [ "$(printf '%s' "$found" | jq -r '.blockersCut')" = true ]; then
383
+ BRANCH_NOTES+=("$card or the card it was sliced from has more relations in Linear than ocnus reads, so a card that blocks it may not have been checked")
384
+ fi
370
385
  # The notes are said only once the branch is made, so a type of
371
386
  # Linear's that no branch can hold stops below before any is said.
372
387
  if [ -n "$given_type" ] && [ "$given_type" != "$type" ]; then
@@ -378,6 +393,8 @@ card_branch() {
378
393
  fi
379
394
  else
380
395
  type=$given_type title=$given_title
396
+ # The reason is in the note above: Linear was not asked.
397
+ BRANCH_NOTES+=("$card's blockers were not checked, since Linear was not asked: it starts whether or not a card that blocks it is done")
381
398
  fi
382
399
  short=$(printf '%s' "$title" | short_name)
383
400
  branch=$type/$(printf '%s' "$card" | tr '[:upper:]' '[:lower:]')${short:+-$short}
@@ -546,6 +563,20 @@ parse_targets() {
546
563
  done
547
564
  }
548
565
 
566
+ # What `task start` says when it holds a card, from CARD_OPEN and
567
+ # CARD_STATUS (card_branch): each card that blocks it, or the card it was
568
+ # sliced from, and is not done yet, and that the card stays where it is.
569
+ # held_message <card ID>
570
+ held_message() {
571
+ local card=$1 where='where it is in Linear'
572
+ [ -z "$CARD_STATUS" ] || where="in $CARD_STATUS"
573
+ printf '%s is held: a card that blocks it is not done yet, so no task was made for it.\n' "$card"
574
+ printf '%s' "$CARD_OPEN" | jq -r --arg card "$card" '.[]
575
+ | " blocker \(.id)\(if .status == "" then "" else ", in \(.status)," end) blocks "
576
+ + (if .of == $card then $card else "\(.of), the card \($card) was sliced from" end)'
577
+ printf '%s stays %s. Run this again once the cards that block it are done.' "$card" "$where"
578
+ }
579
+
549
580
  # What `task start` takes after the card.
550
581
  START_ARGS='[--type <type> --title <title>] [<repo>[:<group>[,<group>...]] ...]'
551
582
 
@@ -620,6 +651,9 @@ task_start() {
620
651
  # Linear names the branch, or the type and title given when Linear cannot,
621
652
  # once everything here has been checked.
622
653
  card_branch "$name" "$card" "$given_type" "$given_title"
654
+ # A card waits until every card that blocks it, or the card it was sliced
655
+ # from, is done, so it is held before anything is fetched or made.
656
+ [ -z "$CARD_OPEN" ] || die "$(held_message "$card")"
623
657
  branch=$BRANCH
624
658
  task=$(task_name "$branch")
625
659
  tdir=$dir/tasks/$task
package/cli/ocnus CHANGED
@@ -53,8 +53,9 @@ Usage:
53
53
  or with no card the cards that have hand-offs and where each stands
54
54
  ocnus linear key save your Linear API key, so ocnus can read and write Linear cards
55
55
  (it says when the key can read cards but not change them)
56
- ocnus linear read <card> [--json] print a card whole: its head, description, comments and
57
- sub-issues (--json for programs)
56
+ ocnus linear read <card> [--json] print a card whole: its head, with the cards that block it
57
+ and that it blocks, description, comments and sub-issues
58
+ (--json for programs)
58
59
  ocnus linear type <card> <feat|fix|chore>
59
60
  set a card's type, its label in the Type group
60
61
  ocnus linear section <card> <Specification|Plan|Breakdown|Review> [--replace]
@@ -62,6 +63,9 @@ Usage:
62
63
  ocnus linear slices <card> make a card's slices as its sub-issues, each with the card's
63
64
  type and blocked by the one before; the slices on stdin,
64
65
  and a run again makes only the ones still missing
66
+ ocnus linear block <card> <blocker>...
67
+ record in Linear that each blocker blocks the card, skipping
68
+ one it has already; it removes none
65
69
  ocnus linear move <card> <approved|started|review|done>
66
70
  move a card forward in Linear: to its team's first
67
71
  not-started status (Todo) with its sub-issues, its first
@@ -109,8 +113,8 @@ status. It needs two things set once. `linear key` asks for a Linear API key
109
113
  and saves it (make one in Linear, under Settings, Account, Security & access,
110
114
  Personal API keys; Read permission is enough to list cards and for
111
115
  `linear read`, which the card skills read a card with, and the card skills'
112
- writes, `linear type`, `linear section`, `linear slices` and `linear move`,
113
- need Write too).
116
+ writes, `linear type`, `linear section`, `linear slices`, `linear block` and
117
+ `linear move`, need Write too).
114
118
  `linear key` and `status` check whether the key can change cards, by asking
115
119
  Linear to change a card that cannot exist, which changes nothing. A key that
116
120
  can read cards but not change them is still saved, and `linear key` says
@@ -123,7 +127,7 @@ with jq.
123
127
  `task new` takes the card's ID, like ABC-122. It opens a tab in the space,
124
128
  in Herdr, and starts an agent there, which writes the card up with the
125
129
  sdlc-define, sdlc-plan and sdlc-breakdown skills and asks you to approve it.
126
- Once you do, it runs task start, unless you hold the build phase for later.
130
+ Once you do, it runs task start: approving a card starts it.
127
131
  With the breakdown approval off (see `approval` below), it asks only about a
128
132
  card it has a doubt about, and approves and starts any other by itself.
129
133
  The Herdr app need not be open: with it closed, the agent starts in a
@@ -138,11 +142,15 @@ Linear for the card and names the branch from it, <type>/<card-id>-<short-name>
138
142
  group, and the short name is the first four words of its title, leaving out
139
143
  a, an and the, like feat/abc-122-export-orders-as-csv. It stops before it
140
144
  makes anything when Linear has no such card, the card has no type, no key is
141
- saved, or Linear cannot be asked. Without a key Linear accepts, give the
145
+ saved, or Linear cannot be asked. It also holds a card, making nothing and
146
+ leaving it in Todo, while a card that blocks it, or the card it was sliced
147
+ from, is not done yet: it names each such card, and you run it again once
148
+ they are done. Without a key Linear accepts, give the
142
149
  card's type and title after it, as the command the write-up phase runs or
143
150
  gives you then does: `--type feat --title 'Export orders as CSV'` names the
144
151
  branch Linear's would. They are used only when no key is saved or Linear cannot be
145
- asked (a rejected key, the network, no curl or jq), with a note saying why.
152
+ asked (a rejected key, the network, no curl or jq), with a note saying why,
153
+ and a note that the card's blockers were not checked.
146
154
  With a key Linear accepts, Linear's type and title win, with a note naming
147
155
  each given one that differs. Both are given or neither, and a type that is
148
156
  not a branch type stops it. It makes a folder in the space's tasks/ folder
@@ -224,9 +232,9 @@ from: it starts `task close` for it in herdr-core, detached, with no tab.
224
232
  session with /exit, which archives it in the Claude app's list, then closes
225
233
  its tab, or with the Herdr app closed ends its terminal. It never kills a
226
234
  live agent: one that has not exited 30 seconds after /exit, or a program in
227
- the tab that reports no status, leaves the tab open. With start later, the
228
- session stays open until task start is run, and a task start that stops
229
- leaves it open. Run in the write-up tab itself, task close refuses.
235
+ the tab that reports no status, leaves the tab open. A task start that
236
+ stops, or holds the card, leaves the write-up session open until task start
237
+ is run again and opens the build tab. Run in the write-up tab itself, task close refuses.
230
238
  `task finish` ends a task once its work has merged: it removes the task's
231
239
  worktrees, deletes its branch in each repo, deletes its folder and closes its
232
240
  tab, or with the Herdr app closed ends the tab's terminals in herdr-core. It
package/herdr/README.md CHANGED
@@ -170,7 +170,7 @@ opened, and links them with the app open or closed once it has.
170
170
  | It says | When | Its exit code |
171
171
  |---|---|---|
172
172
  | `writes`, that the key can change cards | Linear said there is no such card. | not changed |
173
- | `problem`, that the key can read cards but not change them | Linear refused the change for want of Write permission. `task ls`, the Cards panel and `linear read` work, but `linear type`, `linear section`, `linear slices` and `linear move` fail, and the card skills fall back to the agent's own Linear tools. Make a key with Write permission in Linear and save it with `ocnus linear key`. | non-zero |
173
+ | `problem`, that the key can read cards but not change them | Linear refused the change for want of Write permission. `task ls`, the Cards panel and `linear read` work, but `linear type`, `linear section`, `linear slices`, `linear block` and `linear move` fail, and the card skills fall back to the agent's own Linear tools. Make a key with Write permission in Linear and save it with `ocnus linear key`. | non-zero |
174
174
  | `note`, that this was not checked, and why | Linear went out of reach, something between this machine and Linear answered for it, or Linear's answer said neither. It does not say the key cannot change cards. | not changed |
175
175
 
176
176
  The key itself is never shown.
@@ -264,7 +264,9 @@ that name, and its `CLAUDE.md` and `AGENTS.md` link to it.
264
264
 
265
265
  A task is one piece of work in a space, usually a Linear card. Two
266
266
  commands make it, in this order: `task new`, then `task start`, which the
267
- write-up phase runs for you once you approve the card, unless you hold it.
267
+ write-up phase runs for you as soon as you approve the card. `task start`
268
+ holds a card that a card not done yet blocks (see
269
+ [Starting the work](#starting-the-work)).
268
270
  Two more, `task handoff` and `task log`, record and show how each step ended.
269
271
  `task ls` lists the cards there are to start.
270
272
 
@@ -415,12 +417,28 @@ ocnus task new <space> <card>
415
417
  with the card and space filled in. It tells the agent to start with
416
418
  `sdlc-define` and follow each skill's handoff block to the next
417
419
  (`sdlc-plan`, then `sdlc-breakdown`), in that one session, and to wait for
418
- your approval at the end, then start the build phase unless you hold it.
420
+ your approval at the end, then start the build phase.
419
421
  With the breakdown approval off, it tells the agent that `sdlc-breakdown`
420
422
  approves a card it has no doubt about by itself, and that the agent then
421
- runs `task start` as for an approval to start now (see
423
+ runs `task start` as for your approval (see
422
424
  [The breakdown approval](#the-breakdown-approval)). Edit that file to change
423
425
  what the agent is told.
426
+ - **Breakdown records the cards a card waits on.** `sdlc-breakdown` looks
427
+ for every other card that the card, or one of its slices, needs merged
428
+ first: in the card's description, Specification and Plan, and among the
429
+ open cards of the space's teams (`task ls`), a slice of another card too.
430
+ The Breakdown names them under the slice they block, or below a card of
431
+ one piece; one the whole card needs goes on its first slice. It also
432
+ looks for cards already approved and not started, in Todo, that need this
433
+ card's work first, and the summary you approve from names both kinds.
434
+ Nothing is recorded before you approve. Once you do, before the approval
435
+ is recorded and `task start` runs, it records each with
436
+ `ocnus linear block` (see the table below): the card's own blockers on
437
+ the card, or on the slice they block, and this card, or its first slice
438
+ that the other card needs, as a blocker of each card in Todo that needs
439
+ it. Since `task start` holds a card while a card that blocks it is not
440
+ done, that keeps the work in the order it needs. `ocnus linear read`
441
+ shows a card's blockers, and the cards it blocks.
424
442
  - **Your approval moves the card.** Once you approve it, and its sub-issues
425
443
  exist when it was sliced, the agent records the approval, and recording it
426
444
  moves the card in Linear to its team's first not-started status (Todo in
@@ -431,34 +449,35 @@ ocnus task new <space> <card>
431
449
  With the breakdown approval off, an approval the setting gave, on a card
432
450
  the agent has no doubt about, moves the card the same way, and its summary
433
451
  says that the setting gave it.
434
- - **Your approval starts the build phase, unless you hold it.** The approval
435
- asks whether to start the build phase now. With `approve and start`, or any approval
436
- that does not hold it back, the agent runs `ocnus task start` itself
437
- once the approval is recorded (see [Starting the work](#starting-the-work)),
438
- and the task's new tab opens, in the Herdr app, or in herdr-core while the
439
- app is closed, as when you run it yourself. For a card
440
- that was sliced, it starts the first sub-issue that is not already started,
441
- done or canceled. With `approve, start later`, or an approval that holds it
442
- back in other words, the approval is the same and moves the card the same
443
- way, but the agent gives you the command to run when you want the build
444
- phase to start. The agent passes on what `task start` says still needs you, such as
445
- a repo Claude Code will ask about trusting. When `task start` stops, the
446
- agent does not run it again: it tells you what it said and what to run once
447
- that is fixed. `task log` shows which you chose, in your answer and the
448
- approval's summary. A started task adds a `start` row under the card it
452
+ - **Your approval starts the build phase.** The approval asks `approve`,
453
+ `change breakdown`, `change plan` or `change specification`. Once you
454
+ approve, the agent records the approval and runs `ocnus task start` itself
455
+ (see [Starting the work](#starting-the-work)), and the task's new tab
456
+ opens, in the Herdr app, or in herdr-core while the app is closed, as when
457
+ you run it yourself. For a card that was sliced, it starts the first
458
+ sub-issue that is not already started, done or canceled. No approval holds
459
+ the build phase back: a card you want to hold, leave unapproved, and it
460
+ stays in Backlog. A card that another card blocks needs no holding back,
461
+ since `task start` holds it by itself, making nothing and leaving it in
462
+ Todo, until every card that blocks it, or the card it was sliced from, is
463
+ done; the agent tells you which cards it named, and you run `task start`
464
+ once they are. The agent passes on what `task start` says still needs you,
465
+ such as a repo Claude Code will ask about trusting. When `task start` stops,
466
+ the agent does not run it again: it tells you what it said and what to run
467
+ once that is fixed. A started task adds a `start` row under the card it
449
468
  started, which for a sliced card is the sub-issue, so it is in that
450
469
  sub-issue's log. With the breakdown approval off, the agent asks you
451
- nothing on a card it has no doubt about: the setting's approval is one to
452
- start now, so it runs `task start` itself. A card it has a doubt about still
453
- waits for your answer.
470
+ nothing on a card it has no doubt about: the setting's approval starts the
471
+ card as yours does, so it runs `task start` itself. A card it has a doubt
472
+ about still waits for your answer.
454
473
  - **The write-up session is put away once the build phase starts.** The
455
474
  approval itself closes nothing. Once `task start` has opened the build tab,
456
475
  the write-up agent's session ends when its turn does, and its tab closes
457
- (see [Putting the write-up away](#putting-the-write-up-away)). So with
458
- `approve and start`, the agent passes on what `task start` said in the turn
459
- that ran it, and asks nothing after. With `approve, start later`, the
460
- session stays open until you run `task start`, from any terminal. When
461
- `task start` stops, it stays open, and the agent says what to run next.
476
+ (see [Putting the write-up away](#putting-the-write-up-away)). So the
477
+ agent passes on what `task start` said in the turn that ran it, and asks
478
+ nothing after. When `task start` holds the card, the session stays open
479
+ until you run `task start` again, from any terminal. When `task start`
480
+ stops, it stays open, and the agent says what to run next.
462
481
  - **It makes no branch, worktree or task folder.** The card has no type until
463
482
  the agent has defined it, and the type is the start of the branch name.
464
483
  - **It checks first.** An unknown space, something that is not a card ID,
@@ -475,32 +494,36 @@ ocnus task new <space> <card>
475
494
  not asked, and when Linear cannot be asked (the network, a rejected key, no
476
495
  `curl` or `jq`), the card starts as before, with a note saying why.
477
496
  - **The skills read and write the card through ocnus.** The agent reads
478
- the card with one ocnus command, and sets the type, writes each section
479
- and makes a sliced card's sub-issues with three more, so the read and the
480
- writes go the same way on every run. A fifth, which `sdlc-pr` runs once its
481
- pull requests are open, moves the card (see [Hand-offs](#hand-offs)). The
482
- agent's own Linear tools are for when ocnus cannot read or write the
483
- card, and for other reads, such as a related card:
497
+ the card with one ocnus command, and sets the type, writes each section,
498
+ makes a sliced card's sub-issues and records the cards that block a card
499
+ with four more, so the read and the writes go the same way on every run. A
500
+ sixth, which `sdlc-pr` runs once its pull requests are open, moves the
501
+ card (see [Hand-offs](#hand-offs)). The agent's own Linear tools are for
502
+ when ocnus cannot read or write the card, and for other reads, such as a
503
+ related card:
484
504
 
485
505
  | Command | What it does |
486
506
  |---|---|
487
- | `ocnus linear read <card> [--json]` | Prints the card whole: its ID and title, then its status, labels, parent and Linear project (each when it has one) and URL, the description with its sections as written, each comment with who wrote it and when, oldest first, and each sub-issue with its ID, status and title. A comment an app made is the app's. Control characters become spaces, as in `task ls`, but the description and the comments keep their line breaks. `--json` prints the same as one line for programs such as a mod, with the text as Linear gave it: `{"id", "title", "url", "status": {"name", "type"}, "type", "labels", "parent": {"id", "title"}, "project": {"name"}, "description", "comments": [{"author", "createdAt", "body"}], "subIssues": [{"id", "title", "status": {"name", "type"}}]}`. `type` is the card's label in the `Type` group, `labels` the names of all its labels, and `type`, `parent` and the Linear project are `null` when the card has none. A card with more than 100 comments, 50 sub-issues or 100 labels is not printed, since what was read would pass for the whole: the command says so and exits non-zero. When it fails it prints nothing on stdout. It needs only Read permission. |
507
+ | `ocnus linear read <card> [--json]` | Prints the card whole: its ID and title, then its status, labels and parent, a line for each card that blocks it, `Blocked by: <ID> <status> <title>`, and for each card it blocks, `Blocks: <ID> <status> <title>`, done or not, then its Linear project (each when it has one) and URL, the description with its sections as written, each comment with who wrote it and when, oldest first, and each sub-issue with its ID, status and title, oldest first, in the order they were made, which is the order `linear slices` makes a card's slices in. A comment an app made is the app's. Control characters become spaces, as in `task ls`, but the description and the comments keep their line breaks. `--json` prints the same as one line for programs such as a mod, with the text as Linear gave it: `{"id", "title", "url", "status": {"name", "type"}, "type", "labels", "parent": {"id", "title"}, "blockedBy": [{"id", "title", "status": {"name", "type"}}], "blocks": [{"id", "title", "status": {"name", "type"}}], "project": {"name"}, "description", "comments": [{"author", "createdAt", "body"}], "subIssues": [{"id", "title", "status": {"name", "type"}}]}`. `type` is the card's label in the `Type` group, `labels` the names of all its labels, and `type`, `parent` and the Linear project are `null` when the card has none. `blockedBy` and `blocks` come from the card's relations of the kind blocks alone, so a card only related to another is in neither. A card with more than 100 comments, 50 sub-issues, 100 labels, or 50 relations to other cards or from them, is not printed, since what was read would pass for the whole: the command says so and exits non-zero. When it fails it prints nothing on stdout. It needs only Read permission. |
488
508
  | `ocnus linear type <card> <feat\|fix\|chore>` | Sets the card's type: its one label in the `Type` label group, the team's or else the workspace's. Any other type comes off; the card's other labels are never touched. A missing label is refused, never made. |
489
509
  | `ocnus linear section <card> <Specification\|Plan\|Breakdown\|Review> [--replace]` | Adds the section, its body on stdin, below the description. Specification, Plan and Review are folded away, in the form Linear keeps them in, `+++ ## <name>` … `+++` (one written as `>>>` is read the same); the Breakdown is left open, because you read it to approve the card. The Review, which the review step writes, comes after the Breakdown, and each later round puts its own in the last one's place with `--replace`. A section of that name already there is refused, unless `--replace` puts the new one in its place; `--replace` with none there is refused too. A body is refused when a line in it would end the section early or start a second one: a fold line, and in the Breakdown a `#` or `##` heading. A line inside a fenced code block is never taken for a section. |
490
510
  | `ocnus linear slices <card>` | Makes the card's slices, given on stdin, as its sub-issues, in order: for each slice a line `<n>. <name>`, and its description indented below it. Each is made in the card's team, with the name as its title, the description, and the card's type, its one label in the `Type` group; each but the first is marked as blocked by the slice before it. It prints a line for each slice, `Slice <n> of <total>: <ID> <name>`, saying whether it was made or was there already. A slice is there already when the card has a sub-issue with its name as its title, exactly: it is left as it is, and only its blocker is added when it lacks one. So a run that stopped partway, which says what it made and why it stopped, is finished by running it again with the same slices, and no slice is made twice. Any other sub-issue of the card is named, and left alone. It makes nothing when the slices are fewer than two, numbered out of order, of one name twice or without a description, or when the card has no type or more than one, is itself a sub-issue, has more than 50 sub-issues, or has two sub-issues of one slice's name. |
511
+ | `ocnus linear block <card> <blocker>...` | Records in Linear that each blocker given blocks the card: a relation of the kind blocks, from the blocker to the card, as `linear slices` makes between slices. Every card is read first, so an ID Linear does not have records nothing. A blocker the card has already is skipped, one given twice is recorded once, and nothing is ever removed. It prints a line for each blocker, `<card> is now blocked by <blocker>` or `<card> is blocked by <blocker> already`. A run that stopped partway says what it recorded and why it stopped, and is finished by running it again with the same cards. It records nothing when a card ID is not one, or when a blocker is the card itself. `sdlc-breakdown` runs it once the card is approved, for the cards a card or its slices depend on, and for a card in Todo that needs this one first. |
491
512
  | `ocnus linear move <card> <approved\|started\|review\|done>` | Moves the card forward to its team's first not-started status (Todo in Lab, Ready for Dev in PHY), its first started status (In Progress), its last started one (In Review), or its first completed one (Done), picked by its kind and its place in the team's order, not by its name. `approved` moves each of the card's sub-issues after it the same way, by its own team's statuses, and is the move your approval makes. For a slice, `started` and `done` move the card it was sliced from after it the same way: `started` as `task start` does, and `done` as the merge does, only once the slice is closed and every other sub-issue of that card is closed too, done, canceled or a duplicate. While any is open the parent stays where it is, and the command names the open ones, as `ABC-100 stays in In Progress: 2 of its 3 slices are still open (ABC-123, ABC-124)`, and exits zero. A parent with more than 50 sub-issues is not moved, since one it did not read may be open, and neither is the parent of a slice that was not moved. In a team with one started status, `review` is that status. A card already there, further on, done or canceled stays where it is, and the command says so and exits zero. A move that cannot be made, such as with Linear out of reach or a key without Write permission, exits non-zero, saying which card was not moved and why; the other cards still move. |
492
513
 
493
- The four that write read back what Linear saved before they say they are
514
+ The five that write read back what Linear saved before they say they are
494
515
  done: one type, the one asked for; the section there once, and the text
495
516
  above it as it was; each slice made a sub-issue of the card, with the
496
- slice's name and the card's type, and each blocker added; the card in the
497
- status it was moved to. All four need your key to have Write permission.
517
+ slice's name and the card's type, and each blocker added; each blocker
518
+ `linear block` records, from the blocker to the card; the card in the
519
+ status it was moved to. All five need your key to have Write permission.
498
520
  With no key saved, or a key Linear rejects, the skills read the card, and
499
- write the type and the sections and make the slices, with the agent's
500
- Linear tools instead, and say so in the hand-off's flags; the card is not
501
- moved then, and `sdlc-pr` says so. `sdlc-review` writes the Review with
502
- them, and `sdlc-breakdown` the Breakdown and the slices, when Linear answers
503
- the write with an error too, as it does for a key without Write permission.
521
+ write the type and the sections, make the slices and record the blockers,
522
+ with the agent's Linear tools instead, and say so in the hand-off's flags;
523
+ the card is not moved then, and `sdlc-pr` says so. `sdlc-review` writes
524
+ the Review with them, and `sdlc-breakdown` the Breakdown, the slices and
525
+ the blockers, when Linear answers the write with an error too, as it does
526
+ for a key without Write permission.
504
527
 
505
528
  ### The Cards panel
506
529
 
@@ -559,8 +582,8 @@ Each step of the write-up phase ends by handing off: which step it was, how it
559
582
  ended (`done`, `needs-human` or `failed`) and what comes next. Breakdown, the
560
583
  last of them, hands off `done` with `start` next once you approve the card,
561
584
  or once the setting does, with the breakdown approval off (see below):
562
- the next step is `ocnus task start`, which the agent runs, or gives
563
- you to run when you chose to start later. Recording that hand-off moves the card in Linear to its team's first not-started status (Todo
585
+ the next step is `ocnus task start`, which the agent runs as soon as the
586
+ card is approved. Recording that hand-off moves the card in Linear to its team's first not-started status (Todo
564
587
  in Lab, Ready for Dev in PHY), and each of its sub-issues with it, by its own
565
588
  team's statuses. What happened to each card is said on stderr; when one cannot
566
589
  be moved, the hand-off is still recorded, the note names each card that was
@@ -882,8 +905,7 @@ ocnus task start <space> <card> [--type <type> --title <title>] [<repo>[:<group>
882
905
  ```
883
906
 
884
907
  - **The card is its ID**, like `ABC-122`, as for `task new`. The write-up
885
- phase runs this command once you approve the card, or gives it to you when
886
- you chose to start later. For a card that was sliced, it uses the first
908
+ phase runs this command as soon as you approve the card. For a card that was sliced, it uses the first
887
909
  sub-issue that is not already started, done or canceled. When no Linear key
888
910
  is saved, or Linear rejected the key, the command has that card's type and
889
911
  title too.
@@ -915,6 +937,27 @@ ocnus task start <space> <card> [--type <type> --title <title>] [<repo>[:<group>
915
937
  flag with no value, or an option it does not know stops it too, before
916
938
  Herdr or Linear is asked. A branch in place of the card is refused too,
917
939
  with a note that `task start` takes the card now.
940
+ - **It holds a card that a card not done yet blocks.** Linear's answer about
941
+ the card names the cards that block it, and those that block the card it
942
+ was sliced from. While any of them is not in a completed status, such as
943
+ Done, `task start` makes no branch, worktree or tab, sends Linear no change,
944
+ so the card stays in Todo, and exits non-zero. It names each such card,
945
+ with its status and the card it blocks:
946
+
947
+ ```
948
+ ocnus: ABC-122 is held: a card that blocks it is not done yet, so no task was made for it.
949
+ blocker ABC-121, in In Progress, blocks ABC-122
950
+ blocker ABC-90, in Todo, blocks ABC-100, the card ABC-122 was sliced from
951
+ ABC-122 stays in Todo. Run this again once the cards that block it are done.
952
+ ```
953
+
954
+ Run it again once they are done: it then starts the card as usual. A card
955
+ that is only related to another, or a blocker that is done, holds nothing.
956
+ When Linear is not asked, because the type and title are given and no key
957
+ is saved or Linear cannot be asked, the card starts with a note that its
958
+ blockers were not checked. A card, or the card it was sliced from, with
959
+ more than 50 relations in Linear starts with a note that a card that
960
+ blocks it may not have been checked.
918
961
  - **Targets say what the task works on.** Each one names a repo of the
919
962
  space by its folder name, and optionally groups inside it:
920
963
 
@@ -1434,7 +1477,7 @@ ocnus approval [--json | --breakdown on|off]
1434
1477
  approval, so the setting as it is then is the one it goes by, not the one
1435
1478
  when the card was started. With it off, it writes the Breakdown, makes the
1436
1479
  sub-issues when the card is sliced, records its `done` hand-off as an
1437
- approval to start now, whose summary and `approved: setting` line say the
1480
+ approval, whose summary and `approved: setting` line say the
1438
1481
  setting gave it (see [Hand-offs](#hand-offs)), and runs
1439
1482
  `ocnus task start` itself, without asking. Recording it moves the card
1440
1483
  as your approval does. `task handoff` refuses that line while the approval
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngaynor/ocnus",
3
- "version": "2.0.1-next.0",
3
+ "version": "2.0.1-next.9",
4
4
  "description": "A software factory: agent skills and the Herdr setup to run them, installed with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -24,6 +24,6 @@
24
24
  ],
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "git+https://github.com/johngaynor/ocnus.git"
27
+ "url": "git+https://github.com/johngaynor/ocnus-ai.git"
28
28
  }
29
29
  }
@@ -10,8 +10,8 @@ If I ask for a change when I'm approving, sdlc-breakdown tells you which skill m
10
10
 
11
11
  Do every step yourself, in this session. Don't hand a step to a subagent.
12
12
 
13
- sdlc-breakdown asks me to approve the card, and whether to start its build phase now or later. With the breakdown approval off (`ocnus approval --breakdown off`), sdlc-breakdown approves a card it has no doubt about by itself, without asking me, and asks me only about one it has a doubt about. When it hands off with `next: start`, the card is approved, and the work starts with:
13
+ sdlc-breakdown asks me to approve the card, and approving it starts its build phase. With the breakdown approval off (`ocnus approval --breakdown off`), sdlc-breakdown approves a card it has no doubt about by itself, without asking me, and asks me only about one it has a doubt about. When it hands off with `next: start`, the card is approved, and the work starts with:
14
14
 
15
15
  ocnus task start {space} {card}
16
16
 
17
- It names the branch from the type you set on the card and from its title. If the card was sliced, it takes a sub-issue's ID in place of {card}. sdlc-breakdown's Start the build phase says which, and what to do when it stops. Run it yourself only when I approved to start now. When I chose to start later, give it to me and don't run it. When the setting approved the card, run it yourself, as for an approval to start now. When sdlc-breakdown says to give the card's type and title, add `--type` and `--title` to the command, as the skill shows, whether you run it or give it to me.
17
+ It names the branch from the type you set on the card and from its title. If the card was sliced, it takes a sub-issue's ID in place of {card}. sdlc-breakdown's Start the build phase says which, and what to do when it stops. Run it yourself as soon as the card is approved, by me or by the setting. When a card that blocks it, or the card it was sliced from, is not done yet, it holds the card and makes nothing: tell me which cards it named, and give me the command to run once they are done. When sdlc-breakdown says to give the card's type and title, add `--type` and `--title` to the command, as the skill shows, whether you run it or give it to me.
@@ -20,8 +20,8 @@ No more than five lines, in three parts, each starting with its name in bold:
20
20
  Write each line in plain words, for someone who knows the work but has been away from it. Leave out what the human can't act on, such as which files you read. Give no more than the five lines: they can ask for more.
21
21
 
22
22
  ```
23
- - **Task:** ABC-122, a Download CSV button on the orders page, under parent card ABC-100 Orders, in the Linear project Shop.
24
- - **So far:** Written up, approved and started. The build step made the export in api and the button in web, in two commits, and the tests pass.
23
+ - **Task:** ABC-122, a Download CSV button on the orders page, slice 2 of 3 of ABC-100 Orders, in the Linear project Shop.
24
+ - **So far:** Slice 1 (ABC-121) has merged. ABC-122 was approved and started, and the build step made the export in api and the button in web, in two commits; the tests pass.
25
25
  - **Now:** Checking the work against the card's Done when, item 2 of 3.
26
26
  ```
27
27
 
@@ -31,8 +31,8 @@ Write each line in plain words, for someone who knows the work but has been away
31
31
 
32
32
  The session's first message names a Linear card and an ocnus space, and has you record each hand-off for them. After a long run your memory of how it started may be gone, but the card, its log and its commits are not. So read them again for each brief, rather than going from memory:
33
33
 
34
- - **Task:** `ocnus linear read <card>` gives the card's ask, in its title and its original description above the Specification, and, on lines of their own at the top, its parent card and its Linear project. Name the card, what it asks for, and its parent card and Linear project when it has them. When `ocnus linear read` can't read the card, because no Linear key is saved or Linear rejected the key, read it with the Linear tools.
35
- - **So far:** `ocnus task log <space> <card>` gives each step recorded so far and how it ended. Once the task has started, the commits on the task's branch give what the build phase has made: `git log --oneline origin/<default branch>..HEAD` in each of the task's worktrees. What you say has happened agrees with both. Name the steps that are done and what came of them, not every row.
34
+ - **Task:** `ocnus linear read <card>` gives the card's ask, in its title and its original description above the Specification, and, on lines of their own at the top, its parent card and its Linear project. Name the card, what it asks for, and its parent card and Linear project when it has them. A card with a parent is a slice of it: read the parent too, with `ocnus linear read <parent>`, which lists its sub-issues, its slices, in the order breakdown made them. Give the card's place among them with the parent, as `slice N of M of <parent ID> <parent title>`: N is where the card is in that list, and M is how many slices it has. When `ocnus linear read` can't read the card or its parent, because no Linear key is saved or Linear rejected the key, read it with the Linear tools, and count the slices oldest first, by when each was made.
35
+ - **So far:** `ocnus task log <space> <card>` gives each step recorded so far and how it ended. Once the task has started, the commits on the task's branch give what the build phase has made: `git log --oneline origin/<default branch>..HEAD` in each of the task's worktrees. What you say has happened agrees with both. Name the steps that are done and what came of them, not every row. For a slice, open with what has shipped under its parent: name the parent's other slices that are Done, which a slice is once its pull requests have merged, or say that none has shipped yet. For a card with slices of its own, its sub-issues in `ocnus linear read <card>`, open the same way with those of them that are Done, or say that none has shipped yet. Name each Done slice by ID and slice number, as "Slice 1 (ABC-121) has merged.", not by its title, and all of them in one sentence, never a line each, so that the brief stays within five lines however many there are. A card with neither a parent nor slices of its own has no such sentence, and no place among slices on **Task:**.
36
36
  - **Now:** this comes from you: the step you are in and what you are doing in it, or the question you are waiting on.
37
37
 
38
38
  ### In any other session
@@ -11,7 +11,7 @@ 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 the approval, happen on every card: the human approves it, unless they have turned the breakdown approval off and you have no doubt to raise. Creating sub-issues happens only once a card that was sliced is approved.
14
+ This skill has three parts. Proposing, and the approval, happen on every card: the human approves it, unless they have turned the breakdown approval off and you have no doubt to raise. Creating sub-issues happens only once a card that was sliced is approved. Recording the blockers, the other cards the card waits on and the cards that wait on it, happens once any card is approved.
15
15
 
16
16
  ## Before you write anything
17
17
 
@@ -63,6 +63,19 @@ Some work has no cut that passes the checks. A refactor may have nothing to clic
63
63
 
64
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
+ ### Find the cards it depends on
67
+
68
+ A card often needs another card's work merged first, such as a command, a table or a screen that the other card makes. Linear records that as a blocker: a relation of the kind blocks, from the card that has to land first to the card that waits for it. `task start` goes by the blockers, and holds a card while a card that blocks it is not done. So find every such card now, for the card and for each slice. You record them once the card is approved, in part 3.
69
+
70
+ Look in two places:
71
+
72
+ - **This card.** Its description, Specification and Plan name the work it builds on, by card ID or by what that work makes. The `Blocked by:` lines of `ocnus linear read <card ID>` show the blockers it has already.
73
+ - **The open cards of the space's teams**, which `ocnus task ls <space> --json` lists under their statuses. Read each one whose title touches what this card changes or uses, with `ocnus linear read <ID>`.
74
+
75
+ A card is a dependency only when this card, or one of its slices, can't be built or merged until that card's work has merged. A card that is done already, one that is only related, and one that could land in either order are not. A dependency can be a slice of another card, a sub-issue of a card that was sliced: name that slice, by its own ID, not the card it was sliced from, since a card's slices merge one at a time and this card may need only the first.
76
+
77
+ Then look the other way, for cards already approved and not started that need this card first. They are the cards in a not-started status, Todo in Lab or Ready for Dev in PHY, which `task ls` lists under a status with `"type": "unstarted"`. Each was written up without this card, which may not have existed then, so nothing holds it while this card is built. For each one whose work needs this card's, note what it waits on: this card when it is one piece, or the first of its slices whose work the other card needs. A card in Backlog is not approved yet: its own breakdown finds this card when it is written up.
78
+
66
79
  ### Write it to the card
67
80
 
68
81
  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.
@@ -74,6 +87,8 @@ For one piece:
74
87
  ```
75
88
  ocnus linear section <card ID> Breakdown <<'EOF'
76
89
  One piece. <one line on why: already small, or why it can't be cut>
90
+
91
+ Blocked by: <ID and title of each other card it depends on>
77
92
  EOF
78
93
  ```
79
94
 
@@ -84,11 +99,14 @@ ocnus linear section <card ID> Breakdown <<'EOF'
84
99
  1. **<slice name: a short phrase for the behaviour>**
85
100
  - [ ] <its Done when>
86
101
  - [ ] …
102
+ - Blocked by: <ID and title of each other card this slice depends on>
87
103
  2. **<slice name>**
88
104
  - [ ] …
89
105
  EOF
90
106
  ```
91
107
 
108
+ The `Blocked by:` line names the other cards it depends on, from Find the cards it depends on above. Leave it out where there are none. A dependency of the whole card goes on its first slice. The slice before each slice blocks it already, so don't name that one.
109
+
92
110
  To change a Breakdown that is already on the card, run the same command with `--replace` after the section name.
93
111
 
94
112
  Create nothing else in Linear yet. A proposal the human turns down should leave nothing behind to clean up.
@@ -100,8 +118,8 @@ Breakdown is the last step of the write-up phase, so it ends with the whole card
100
118
  First read the breakdown approval, with `ocnus approval --json`. Read it when you get to the approval, not before: the human may turn it on or off while the card is written up, and the setting as it is now is the one that counts. It prints one line, such as `{"file":"…/settings.json","approval":{"breakdown":true}}`.
101
119
 
102
120
  - **`"breakdown": true`**: ask the human, as below. With nothing set, no setting in the file or no file, it is `true`.
103
- - **`"breakdown": false`, and you have no doubt to raise**: don't ask. The setting approves the card, and its approval is one to start now. When the card is sliced, go on to part 2, then hand off. When it is one piece, hand off. Both are described below.
104
- - **`"breakdown": false`, and you have a doubt to raise**: ask the human, as below, and put the doubt in the summary. A doubt is what this skill says to raise when you ask the human to approve: a sub-issue that looks too big to stay one piece, more than six slices, which makes the card look like several cards, or a card that can't be cut and is large.
121
+ - **`"breakdown": false`, and you have no doubt to raise**: don't ask. The setting approves the card, which starts it as the human's approval does. When the card is sliced, go on to part 2 and part 3, then hand off. When it is one piece, go on to part 3, then hand off. All are described below.
122
+ - **`"breakdown": false`, and you have a doubt to raise**: ask the human, as below, and put the doubt in the summary. A doubt is what this skill says to raise when you ask the human to approve: a sub-issue that looks too big to stay one piece, more than six slices, which makes the card look like several cards, a card that can't be cut and is large, or a card you can't tell whether to record as a blocker of this card, or as blocked by it.
105
123
  - **The command fails, or prints anything else**, such as when the settings file is not valid settings or this machine's `ocnus` has no `approval` command: ask the human, as below, and say in the summary that the breakdown approval could not be read, and why, in the command's words.
106
124
 
107
125
  The setting is for this approval alone. A question define or plan asked earlier in the write-up waited for the human's answer, and so does one this skill asks before it gets here, such as whether to revise a Breakdown the card already has.
@@ -112,15 +130,16 @@ When you ask, give them a summary they can answer from without opening Linear:
112
130
  - The Done when list.
113
131
  - The approach, in a sentence or two.
114
132
  - Whether it is one piece or several, and why. If several, the slice names in order.
133
+ - The other cards it depends on, by ID and title, for the card or for each slice, and the cards in Todo that need it first, which it will be recorded as blocking. Say so when there are none.
115
134
 
116
- Then ask them to approve or say what to change. An approval also says when the build phase starts: now, or later, when they start it themselves. Record the ask as a hand-off with this block, then end your message with the summary and, below it, the block the command printed:
135
+ Then ask them to approve or say what to change. Approving the card starts its build phase: once the approval is recorded, you run `task start` on it. Record the ask as a hand-off with this block, then end your message with the summary and, below it, the block the command printed:
117
136
 
118
137
  ```
119
138
  ocnus task handoff <space> <card ID> <<'EOF'
120
139
  step: breakdown
121
140
  status: needs-human
122
- question: Approve <card ID> as specified, planned and broken down, and start its build phase now?
123
- options: approve and start | approve, start later | change breakdown | change plan | change specification
141
+ question: Approve <card ID> as specified, planned and broken down, and start its build phase?
142
+ options: approve | change breakdown | change plan | change specification
124
143
  EOF
125
144
  ```
126
145
 
@@ -130,10 +149,10 @@ Wait for their answer.
130
149
  |---|---|
131
150
  | Change the breakdown | Revise the Breakdown section, with `--replace`, and ask again |
132
151
  | 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 |
133
- | Approve, and the card is one piece | The card is ready to build. Hand off, as described below |
134
- | Approve, and the card is sliced | Go on to part 2 |
152
+ | Approve, and the card is one piece | The card is ready to build. Go on to part 3, then hand off, as described below |
153
+ | Approve, and the card is sliced | Go on to part 2, then part 3 |
135
154
 
136
- Approve and start, and approve, start later, are both an approval: everything above and below is the same for each, and only what follows the hand-off differs. Go by what they mean, not by the exact words. An approval that does not hold the build phase back, such as `approve` or `yes`, is one to start now. One that holds it back in any words, such as later, not yet or I'll start it, is one to start later. If you can't tell which, ask. When you record their answer, say which they chose, so that `ocnus task log` shows it. An approval by the setting, with the breakdown approval off, is one to start now, and since no one was asked, there is no answer to record.
155
+ Go by what they mean, not by the exact words: `approve`, `yes` or `go ahead` approves the card. An approval always starts the build phase: none holds it back. When they approve the card but want its start held back, in any words, such as not yet or I'll start it, tell them that approving starts it, and ask again: a card they want to hold stays unapproved, in Backlog, until they approve it. A card that another card blocks needs no holding back: `task start` holds it by itself until every card that blocks it, or the card it was sliced from, is done. An approval by the setting, with the breakdown approval off, starts the card in the same way, and since no one was asked, there is no answer to record.
137
156
 
138
157
  ## Part 2: Create the sub-issues
139
158
 
@@ -150,7 +169,7 @@ Do this only when the card has been approved in this session, by the human or by
150
169
  EOF
151
170
  ```
152
171
 
153
- It makes each slice a sub-issue of the card, with the slice name as its title and the card's type, since slices don't get a type of their own, and marks it as blocked by the slice before it. The first slice is blocked by nothing. It reads back each one it makes, then prints a line for each slice, `Slice <n> of <total>: <sub-issue ID> <slice name>`, which gives you each sub-issue's ID. A slice that a run before has made already, a sub-issue of the card with the slice's name as its title, is left as it is, and only its blocker is added when it lacks one. It names any other sub-issue the card has, and leaves it alone.
172
+ It makes each slice a sub-issue of the card, with the slice name as its title and the card's type, since slices don't get a type of their own, and marks it as blocked by the slice before it. The first slice is blocked by no slice. The other cards a slice depends on are recorded in part 3. It reads back each one it makes, then prints a line for each slice, `Slice <n> of <total>: <sub-issue ID> <slice name>`, which gives you each sub-issue's ID. A slice that a run before has made already, a sub-issue of the card with the slice's name as its title, is left as it is, and only its blocker is added when it lacks one. It names any other sub-issue the card has, and leaves it alone.
154
173
  2. **Write each sub-issue's sections**, in order, in the same form as any card, each with its own command and the sub-issue's ID, in this order:
155
174
  - A Specification, with the parent's Why narrowed to this slice, and the slice's Done when: `ocnus linear section <sub-issue ID> Specification <<'EOF'`.
156
175
  - A Plan, with the approach in a sentence or two, only the files this slice touches, and the Tests lines for its Done when items: `ocnus linear section <sub-issue ID> Plan <<'EOF'`.
@@ -158,20 +177,41 @@ Do this only when the card has been approved in this session, by the human or by
158
177
 
159
178
  A sub-issue has to stand alone. The build step will open it in a fresh session and see only that card, so anything it needs from the parent goes into it.
160
179
 
161
- Then update the parent's Breakdown list so each slice name carries its sub-issue's ID, with `ocnus linear section <card ID> Breakdown --replace`. The parent is not built. It stays as the record of the whole.
180
+ Then update the parent's Breakdown list so each slice name carries its sub-issue's ID, with `ocnus linear section <card ID> Breakdown --replace`. Keep each slice's `Blocked by:` line as it is. The parent is not built. It stays as the record of the whole.
181
+
182
+ Read the parent and each sub-issue back, then go on to part 3.
183
+
184
+ ## Part 3: Record the blockers
162
185
 
163
- Read the parent and each sub-issue back, then hand off.
186
+ Do this once the card is approved in this session, by the human or by the setting, whether it is one piece or sliced, and before you hand off: `task start` reads the blockers when it starts the card, so they have to be in Linear first. Record nothing before the approval: a proposal the human turns down should leave nothing behind to clean up.
187
+
188
+ 1. **The cards this card depends on.** For the card, or each slice, that the Breakdown says other cards block, record them with one command: the card that waits first, then each card that blocks it.
189
+
190
+ ```
191
+ ocnus linear block <card ID> <blocker ID>...
192
+ ```
193
+
194
+ When the card is sliced, the card that waits is the slice, by the sub-issue ID `ocnus linear slices` printed for it. A dependency of the whole card goes on its first slice. A blocker that is a slice of another card is given by that slice's own ID, not by the card it was sliced from.
195
+ 2. **The cards in Todo that need this one first.** For each, record this card as its blocker: the other card first, then this card, or the first of its slices that the other card needs.
196
+
197
+ ```
198
+ ocnus linear block <other card ID> <card ID or slice ID>
199
+ ```
200
+
201
+ The command reads every card it is given before it records anything, then records each blocker the card does not have yet, as a relation of the kind blocks from the blocker to the card, and reads each one back. It skips a blocker the card has already, and removes none, so running it again with the same cards is safe. It prints a line for each blocker, `<card> is now blocked by <blocker>` or `<card> is blocked by <blocker> already`. It refuses a card given as its own blocker, and records nothing then.
202
+
203
+ When no other card blocks the card or any of its slices, and no card in Todo needs it first, there is nothing to record. Either way, hand off next.
164
204
 
165
205
  ## Hand off
166
206
 
167
- Breakdown is finished when the card is approved, by the human or by the setting, and, if it was sliced, its sub-issues exist. Then record the hand-off:
207
+ Breakdown is finished when the card is approved, by the human or by the setting, its sub-issues exist if it was sliced, and its blockers are recorded. Then record the hand-off:
168
208
 
169
209
  ```
170
210
  ocnus task handoff <space> <card ID> <<'EOF'
171
211
  step: breakdown
172
212
  status: done
173
213
  next: start
174
- summary: <that the card is approved, by the human or by the setting, to start now or later; whether it is one piece or sliced; if sliced, the sub-issues in order with their IDs, and which one is first>
214
+ summary: <that the card is approved, by the human or by the setting; whether it is one piece or sliced; if sliced, the sub-issues in order with their IDs, and which one is first; and each blocker you recorded, naming the card that waits and the card that blocks it, or that there was none to record>
175
215
  flags: <anything that didn't go to plan, such as a blocking relation that couldn't be set>
176
216
  EOF
177
217
  ```
@@ -185,7 +225,7 @@ ocnus task handoff <space> <card ID> <<'EOF'
185
225
  step: breakdown
186
226
  status: done
187
227
  next: start
188
- summary: Approved by the setting, with the breakdown approval off, to start now. <whether it is one piece or sliced; if sliced, the sub-issues in order with their IDs, and which one is first>
228
+ summary: Approved by the setting, with the breakdown approval off, to start now. <whether it is one piece or sliced; if sliced, the sub-issues in order with their IDs, and which one is first; and each blocker you recorded, naming the card that waits and the card that blocks it, or that there was none to record>
189
229
  flags: <anything that didn't go to plan>
190
230
  approved: setting
191
231
  EOF
@@ -209,16 +249,14 @@ Put the title between single quotes as Linear has it, and write each `'` in it a
209
249
 
210
250
  Once `task start` has opened the build tab, it puts this write-up session away: once this session's turn has ended, it ends the Claude session with `/exit` and closes this tab, which archives the session in the Claude app's list. For a sliced card it does the same once a sub-issue is started, since this tab is named after the card the sub-issue was sliced from.
211
251
 
212
- An approval by the setting is one to start now. Run the command as for the human's approval to start now, below.
213
-
214
- - **The human chose to start later:** give them the command, `ocnus task start <space> <ID>`, and run nothing. This session stays open until that command is run, from any terminal, and that puts it away.
215
- - **The human chose to start now:** run that command yourself, once, after the hand-off above is recorded, or written in your message when it could not be recorded. Then tell the human the tab it opened, and pass on every `agent` and `note` line it printed: those say what still needs them, such as an agent it could not start, a repo Claude Code will ask about trusting, or a card it did not move in Linear. Its `write-up` line says this session is put away once this turn ends. So say everything in this turn and ask nothing after it: once the turn ends, this session is gone.
252
+ Whoever approved the card, the human or the setting, run that command yourself, once, after the hand-off above is recorded, or written in your message when it could not be recorded. Then tell the human the tab it opened, and pass on every `agent` and `note` line it printed: those say what still needs them, such as an agent it could not start, a repo Claude Code will ask about trusting, or a card it did not move in Linear. Its `write-up` line says this session is put away once this turn ends. So say everything in this turn and ask nothing after it: once the turn ends, this session is gone.
216
253
 
217
254
  If it stops, don't run it again. This session stays open, since `task start` puts it away only once it has opened the build tab. Tell the human what it said, and what to do next:
218
255
 
219
256
  | It stopped | Then tell the human |
220
257
  |---|---|
221
- | Before it made the task: what it said has no `made the task at` | To run `ocnus task start <space> <ID>` once what it named is fixed |
258
+ | It held the card: it says `<ID> is held`, and names each card that blocks it, or the card it was sliced from, and is not done yet | That the card is approved and waits for those cards in Todo, with nothing made for it. To run `ocnus task start <space> <ID>` once they are done, from any terminal: that starts its build phase, and puts this session away |
259
+ | Before it made the task, for any other reason: what it said has no `made the task at` | To run `ocnus task start <space> <ID>` once what it named is fixed |
222
260
  | After it made the task: it says `made the task at <folder>` | That the task is made and a second `task start` would be refused, so to open that folder in the space, in Herdr, and run `ocnus task build <space> <ID>` there |
223
261
 
224
262
  ## The handoff block
@@ -264,11 +302,11 @@ EOF
264
302
  |---|---|
265
303
  | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
266
304
  | 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 |
267
- | `ocnus linear` says no Linear key is saved, that Linear rejected the key or that Linear answered with an error, or the command isn't there | Read the card, write the Breakdown, make the slices and write their sections with the Linear tools instead, in the same form: the Breakdown under the heading `## Breakdown`; each slice a sub-issue of the card, with the slice name as its title and the card's type, blocked by the slice before it; and a sub-issue's Specification and Plan each between `>>> ## <name>` and a closing `>>>`. Make only the slices the card has no sub-issue for yet. A key with Read permission alone reads the card and gets the error only at a write: make that write and the rest with them then. Say so in `flags` |
305
+ | `ocnus linear` says no Linear key is saved, that Linear rejected the key or that Linear answered with an error, or the command isn't there | Read the card, write the Breakdown, make the slices, write their sections and record the blockers with the Linear tools instead, in the same form: the Breakdown under the heading `## Breakdown`; each slice a sub-issue of the card, with the slice name as its title and the card's type, blocked by the slice before it; a sub-issue's Specification and Plan each between `>>> ## <name>` and a closing `>>>`; and each blocker a relation of the kind blocks, from the card that blocks to the card that waits. Make only the slices the card has no sub-issue for yet. A key with Read permission alone reads the card and gets the error only at a write: make that write and the rest with them then. Say so in `flags` |
268
306
  | `ocnus linear` says it could not reach Linear | Run it once more. It checks the card before it writes, so it can't add the section twice. If it then says the card already has a Breakdown, the first try got through |
269
307
  | `ocnus linear section` says the text above the section changed | Put it back from what you read at the start of this run, with the Linear tools, and tell the human |
270
308
  | Making the slices stops partway | Don't start over. Run `ocnus linear slices` again with the same list: it finds the slices already made by their names, makes only the missing ones, and adds any blocker that is missing. Then write any section a sub-issue lacks: `ocnus linear section` refuses one that is there |
271
- | 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 |
309
+ | `ocnus linear block` stops, or a blocking relation can't be set | When it says it could not reach Linear, run it again with the same cards: it skips the blockers already there. When it says no Linear key is saved, that Linear rejected the key or that Linear answered with an error, record the rest with the Linear tools, as in the row above. A blocker you still can't record goes in `flags`, naming the card that waits and the card that blocks it, and in your message too: `task start` does not hold a card for a blocker Linear doesn't have. The Breakdown still names it, so it isn't lost |
272
310
  | 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 |
273
311
 
274
312
  If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
@@ -283,7 +321,7 @@ One piece. Four files and one behaviour, small enough for a single pull request.
283
321
  EOF
284
322
  ```
285
323
 
286
- **Sliced.** The card "Order notes" asks that staff can add notes to an order, edit and delete them, and mark some as visible to the customer. The plan touches the database, the API, the staff app and the customer app.
324
+ **Sliced.** The card "Order notes" asks that staff can add notes to an order, edit and delete them, and mark some as visible to the customer. The plan touches the database, the API, the staff app and the customer app. It checks who is staff by the roles that ABC-127, "Staff roles", adds: the first slice of another card, "Staff accounts", not merged yet. And ABC-135, "Notify the customer of a new note", is in Todo and needs the notes the customer sees, which slice 3 makes.
287
325
 
288
326
  ```
289
327
  ocnus linear section ABC-130 Breakdown <<'EOF'
@@ -291,6 +329,7 @@ ocnus linear section ABC-130 Breakdown <<'EOF'
291
329
  - [ ] On an order, a staff member can type a note and save it.
292
330
  - [ ] Saved notes show on the order, newest first, with the author and time.
293
331
  - [ ] Someone who is not staff can neither add nor see notes.
332
+ - Blocked by: ABC-127 Staff roles
294
333
  2. **Staff can edit and delete their own notes**
295
334
  - [ ] A staff member can edit a note they wrote, and the note shows it was edited.
296
335
  - [ ] A staff member can delete a note they wrote, after confirming.
@@ -301,6 +340,13 @@ ocnus linear section ABC-130 Breakdown <<'EOF'
301
340
  EOF
302
341
  ```
303
342
 
343
+ The summary the human approves from names ABC-127 as slice 1's blocker, and ABC-135 as a card in Todo that slice 3 will block. Once the card is approved, and its slices are made as ABC-131, ABC-132 and ABC-133, part 3 records both:
344
+
345
+ ```
346
+ ocnus linear block ABC-131 ABC-127
347
+ ocnus linear block ABC-135 ABC-133
348
+ ```
349
+
304
350
  **The wrong cut** for the same card:
305
351
 
306
352
  ```