@johngaynor/ocnus 0.0.0-stage → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +988 -2
- package/agents/linear-mcp.json +1 -0
- package/agents/ocnus-build.md +23 -0
- package/agents/ocnus-write-up.md +20 -0
- package/cli/host-mark +36 -0
- package/cli/lib/agents.sh +350 -0
- package/cli/lib/approval.sh +94 -0
- package/cli/lib/archive.sh +447 -0
- package/cli/lib/billing.sh +166 -0
- package/cli/lib/close.sh +189 -0
- package/cli/lib/commands.sh +220 -0
- package/cli/lib/common.sh +215 -0
- package/cli/lib/finish.sh +288 -0
- package/cli/lib/github.sh +162 -0
- package/cli/lib/guard.sh +134 -0
- package/cli/lib/handoff.sh +551 -0
- package/cli/lib/host.sh +1802 -0
- package/cli/lib/linear.sh +1389 -0
- package/cli/lib/links.sh +135 -0
- package/cli/lib/merges.sh +853 -0
- package/cli/lib/recipes.sh +54 -0
- package/cli/lib/settings.sh +465 -0
- package/cli/lib/space.sh +343 -0
- package/cli/lib/task.sh +847 -0
- package/cli/lib/tests.sh +268 -0
- package/cli/lib/trust.sh +70 -0
- package/cli/ocnus +630 -0
- package/herdr/README.md +2238 -0
- package/herdr/layouts/default.json +259 -0
- package/herdr/mods/agent-settings/cog.svg +4 -0
- package/herdr/mods/agent-settings/main.js +356 -0
- package/herdr/mods/agent-settings/mod.json +1 -0
- package/herdr/mods/cards/main.js +450 -0
- package/herdr/mods/cards/mod.json +1 -0
- package/herdr/mods/cards/refresh.svg +4 -0
- package/herdr/mods/cpu/main.js +90 -0
- package/herdr/mods/cpu/mod.json +1 -0
- package/herdr/mods/layout-switch/main.js +48 -0
- package/herdr/mods/layout-switch/mod.json +1 -0
- package/herdr/mods/names/main.js +69 -0
- package/herdr/mods/names/mod.json +1 -0
- package/herdr/mods/ocnus-spaces/main.js +376 -0
- package/herdr/mods/ocnus-spaces/mod.json +1 -0
- package/herdr/mods/steps/main.js +354 -0
- package/herdr/mods/steps/mod.json +1 -0
- package/herdr/spaces/template/SPACE.md +19 -0
- package/package.json +27 -4
- package/prompts/task-build.md +11 -0
- package/prompts/task-new.md +17 -0
- package/skills/brief/SKILL.md +64 -0
- package/skills/sdlc-breakdown/SKILL.md +312 -0
- package/skills/sdlc-build/SKILL.md +182 -0
- package/skills/sdlc-define/SKILL.md +203 -0
- package/skills/sdlc-plan/SKILL.md +202 -0
- package/skills/sdlc-pr/SKILL.md +339 -0
- package/skills/sdlc-review/SKILL.md +227 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdlc-breakdown
|
|
3
|
+
description: Decide whether a planned Linear card is one piece or several, by cutting it into thin end-to-end slices (elephant carpaccio) where it can be cut, then, once the card is approved, creating each slice as a sub-issue. Use this after plan on every card, and whenever asked to break down, slice or split a card, or to judge whether a card is too big for one pull request.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Break down a card
|
|
7
|
+
|
|
8
|
+
Breakdown is the third step of the lifecycle. Define said what is wanted and plan said how. Breakdown decides whether the card is built as one piece or as several, and if several, what each piece is.
|
|
9
|
+
|
|
10
|
+
The method is elephant carpaccio: cut the work into slices so thin that each one is small, yet each still works end to end. The aim is the earliest usable slice, followed by slices that extend it. Useful comes before done.
|
|
11
|
+
|
|
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
|
+
|
|
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.
|
|
15
|
+
|
|
16
|
+
## Before you write anything
|
|
17
|
+
|
|
18
|
+
1. Read the card with `ocnus linear read <card ID>`: the Specification and the Plan.
|
|
19
|
+
2. If either is missing, the earlier step hasn't run. Say so and stop.
|
|
20
|
+
3. If the card is itself a sub-issue, don't slice it again. Slices go one level deep. If it looks too big, say so when you ask the human to approve.
|
|
21
|
+
4. If the card already has a Breakdown section, don't write a second one. If the human has asked for it to be revised, revise it in place. Otherwise tell the human and ask whether they want it revised, and if they don't, go on to ask them to approve the card.
|
|
22
|
+
|
|
23
|
+
## Part 1: Propose
|
|
24
|
+
|
|
25
|
+
### First, is it already small?
|
|
26
|
+
|
|
27
|
+
Look at the plan's Changes. If the whole card is one agent, one sitting and one quick pull request, it stands as one piece, even if you could cut it further. Every slice costs the human a pull request to read and merge, so don't slice for its own sake.
|
|
28
|
+
|
|
29
|
+
### If it is too big, try to cut it
|
|
30
|
+
|
|
31
|
+
Cut along behaviour, using Done when as the map. Use the plan only to judge size and order.
|
|
32
|
+
|
|
33
|
+
A piece is a slice only if it passes all four checks:
|
|
34
|
+
|
|
35
|
+
1. **Vertical.** It carries one narrow piece of behaviour through every layer it needs. "The database part" and "the API part" are layers, not slices.
|
|
36
|
+
2. **Testable end to end.** Once it merges, there is something to click, read or call, and its own Done when can be checked without the later slices.
|
|
37
|
+
3. **Mergeable alone.** It is safe on main if nothing after it ever ships. Feature flags aren't available, so a slice has to be acceptable for users to see as it is.
|
|
38
|
+
4. **Small.** One agent, one sitting, one quick pull request.
|
|
39
|
+
|
|
40
|
+
Ways to make a slice thinner while keeping it end to end:
|
|
41
|
+
|
|
42
|
+
- One case before many.
|
|
43
|
+
- A fixed choice before a configurable one.
|
|
44
|
+
- Reading before writing.
|
|
45
|
+
- The main path before the rare ones.
|
|
46
|
+
- One kind of user before the others.
|
|
47
|
+
|
|
48
|
+
Permission and safety checks are not something to thin out. They go in the first slice that exposes the thing they protect, because a slice that ships an unprotected endpoint isn't mergeable alone.
|
|
49
|
+
|
|
50
|
+
Then check the set:
|
|
51
|
+
|
|
52
|
+
- **The first slice is the thinnest path that works.** Each later slice extends the one before.
|
|
53
|
+
- **Nothing is lost.** Every Done when item on the card is covered by a slice, whole or narrowed across more than one.
|
|
54
|
+
- **Nothing is added.** Slices divide the Specification. They don't grow it.
|
|
55
|
+
- **Each slice has its own Done when**, one to four outcomes written by the same rules as the card's.
|
|
56
|
+
- **The slices run in order.** Each builds on the last.
|
|
57
|
+
|
|
58
|
+
Two to five slices is usual. If you need more than six, the card is probably several cards. Propose what you have and say so when you ask the human to approve.
|
|
59
|
+
|
|
60
|
+
### If it can't be cut
|
|
61
|
+
|
|
62
|
+
Some work has no cut that passes the checks. A refactor may have nothing to click halfway through. A migration may have to land together. A first slice may not be acceptable for users to see without the rest.
|
|
63
|
+
|
|
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
|
+
|
|
66
|
+
### Write it to the card
|
|
67
|
+
|
|
68
|
+
Append a Breakdown section below the Plan. Leave it open, not collapsible, because it is what the human reads to approve the card. Change nothing above it.
|
|
69
|
+
|
|
70
|
+
Write it with this command, the section's body on stdin. The command adds the `## Breakdown` heading, leaves the section open, and reads the card back before it says it is done.
|
|
71
|
+
|
|
72
|
+
For one piece:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
ocnus linear section <card ID> Breakdown <<'EOF'
|
|
76
|
+
One piece. <one line on why: already small, or why it can't be cut>
|
|
77
|
+
EOF
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For slices:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
ocnus linear section <card ID> Breakdown <<'EOF'
|
|
84
|
+
1. **<slice name: a short phrase for the behaviour>**
|
|
85
|
+
- [ ] <its Done when>
|
|
86
|
+
- [ ] …
|
|
87
|
+
2. **<slice name>**
|
|
88
|
+
- [ ] …
|
|
89
|
+
EOF
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
To change a Breakdown that is already on the card, run the same command with `--replace` after the section name.
|
|
93
|
+
|
|
94
|
+
Create nothing else in Linear yet. A proposal the human turns down should leave nothing behind to clean up.
|
|
95
|
+
|
|
96
|
+
### Ask the human to approve
|
|
97
|
+
|
|
98
|
+
Breakdown is the last step of the write-up phase, so it ends with the whole card approved: the Specification, the Plan and the Breakdown together. This happens on every card, sliced or not. The human approves it, unless they have turned the breakdown approval off.
|
|
99
|
+
|
|
100
|
+
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
|
+
|
|
102
|
+
- **`"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.
|
|
105
|
+
- **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
|
+
|
|
107
|
+
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.
|
|
108
|
+
|
|
109
|
+
When you ask, give them a summary they can answer from without opening Linear:
|
|
110
|
+
|
|
111
|
+
- The type.
|
|
112
|
+
- The Done when list.
|
|
113
|
+
- The approach, in a sentence or two.
|
|
114
|
+
- Whether it is one piece or several, and why. If several, the slice names in order.
|
|
115
|
+
|
|
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:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
ocnus task handoff <space> <card ID> <<'EOF'
|
|
120
|
+
step: breakdown
|
|
121
|
+
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
|
|
124
|
+
EOF
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Wait for their answer.
|
|
128
|
+
|
|
129
|
+
| The human says | Then |
|
|
130
|
+
|---|---|
|
|
131
|
+
| Change the breakdown | Revise the Breakdown section, with `--replace`, and ask again |
|
|
132
|
+
| 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 |
|
|
135
|
+
|
|
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.
|
|
137
|
+
|
|
138
|
+
## Part 2: Create the sub-issues
|
|
139
|
+
|
|
140
|
+
Do this only when the card has been approved in this session, by the human or by the setting, and only when the breakdown has more than one slice.
|
|
141
|
+
|
|
142
|
+
1. **Make the slices**, all of them with one command. Give it the slices in order on stdin: for each, a line with its number and its name, as the Breakdown has it but without the `**`, and below it, indented, one or two sentences saying what the slice delivers, and nothing else: its sections come next.
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
ocnus linear slices <card ID> <<'EOF'
|
|
146
|
+
1. <slice name>
|
|
147
|
+
<what this slice delivers, in one or two sentences>
|
|
148
|
+
2. <slice name>
|
|
149
|
+
<…>
|
|
150
|
+
EOF
|
|
151
|
+
```
|
|
152
|
+
|
|
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.
|
|
154
|
+
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
|
+
- 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
|
+
- 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'`.
|
|
157
|
+
- A Breakdown that reads `One piece. Slice <n> of <total>.`: `ocnus linear section <sub-issue ID> Breakdown <<'EOF'`.
|
|
158
|
+
|
|
159
|
+
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
|
+
|
|
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.
|
|
162
|
+
|
|
163
|
+
Read the parent and each sub-issue back, then hand off.
|
|
164
|
+
|
|
165
|
+
## Hand off
|
|
166
|
+
|
|
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:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
ocnus task handoff <space> <card ID> <<'EOF'
|
|
171
|
+
step: breakdown
|
|
172
|
+
status: done
|
|
173
|
+
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>
|
|
175
|
+
flags: <anything that didn't go to plan, such as a blocking relation that couldn't be set>
|
|
176
|
+
EOF
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Put your own words in place of each hint in angle brackets, and leave the `flags` line out when there is nothing to flag.
|
|
180
|
+
|
|
181
|
+
When the setting approved the card, start the summary with `Approved by the setting, with the breakdown approval off, to start now.`, and end the block with the line `approved: setting`, so that `ocnus task log` shows that the setting approved the card, not the human:
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
ocnus task handoff <space> <card ID> <<'EOF'
|
|
185
|
+
step: breakdown
|
|
186
|
+
status: done
|
|
187
|
+
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>
|
|
189
|
+
flags: <anything that didn't go to plan>
|
|
190
|
+
approved: setting
|
|
191
|
+
EOF
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The human's approval never has that line: their answer is the approval. The command refuses the line while the breakdown approval is on, or while the settings file can't be read, and records nothing, since the human approves the card then. That can happen when the human turns the approval on after you read it. Then ask the human, as in Ask the human to approve above, and say in the summary that the command refused the setting's approval, and why, in its words.
|
|
195
|
+
|
|
196
|
+
Recording this hand-off moves the card in Linear to its team's first not-started status, Todo in Lab or Ready for Dev in PHY, and, when the card was sliced, each of its sub-issues too. A card already further along, done or canceled stays where it is. Below the block, the command says what happened to each card. When it says a card was not moved, tell the human in your message which card was not moved, and why, such as no Linear key saved or a key without Write permission. They can move it in Linear, or run `ocnus linear move <card ID> approved` with the parent's ID once what stopped it is fixed. The hand-off is recorded either way, so don't record it again.
|
|
197
|
+
|
|
198
|
+
### Start the build phase
|
|
199
|
+
|
|
200
|
+
Start is not a skill. It is the `ocnus task start` command, which makes the task's branch and worktrees, opens its tab in the space and starts an agent there for the build phase. It takes one card: the card itself when it is one piece, or, when it was sliced, the first sub-issue in order that is not already started, done or canceled. If every sub-issue is, start nothing and tell the human so.
|
|
201
|
+
|
|
202
|
+
When the note below the hand-off says the card was not moved because no Linear key is saved, or because Linear rejected the key, `task start` can't read the card's type and title from Linear either. So the command carries them, whether you run it or give it. Take the type and title of the card it takes, the card itself or the first sub-issue as above, from what this run read and made, and put them after the ID. A slice has the card's type, and its name as its title:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
ocnus task start <space> <ID> --type <type> --title '<title>'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Put the title between single quotes as Linear has it, and write each `'` in it as `'\''`, so the command runs as pasted whatever the title holds: `Ada's export` is `--title 'Ada'\''s export'`. With any other note, or none, the command is the plain `ocnus task start <space> <ID>`.
|
|
209
|
+
|
|
210
|
+
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
|
+
|
|
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.
|
|
216
|
+
|
|
217
|
+
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
|
+
|
|
219
|
+
| It stopped | Then tell the human |
|
|
220
|
+
|---|---|
|
|
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 |
|
|
222
|
+
| 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
|
+
|
|
224
|
+
## The handoff block
|
|
225
|
+
|
|
226
|
+
Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
|
|
227
|
+
|
|
228
|
+
Record a hand-off every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Record it even when you go straight on to another step, because the record is what shows this one ended. Run `ocnus task handoff` with the block on stdin, one value per line:
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
ocnus task handoff <space> <card ID> <<'EOF'
|
|
232
|
+
step: <this step>
|
|
233
|
+
status: <done, needs-human or failed>
|
|
234
|
+
next: <the step that follows>
|
|
235
|
+
summary: <one to three sentences on what you did>
|
|
236
|
+
flags: <what the human should know but wasn't asked>
|
|
237
|
+
question: <one question>
|
|
238
|
+
options: <the answers you expect, your recommendation first, separated by " | ">
|
|
239
|
+
answer: <what the human said, in a few words>
|
|
240
|
+
reason: <what went wrong, and what you already tried>
|
|
241
|
+
EOF
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
`<space>` is the ocnus space this session is in. The `step:` line names this step. The words in angle brackets are hints: put your own in their place. The command checks the block, records it and prints it back. Which lines you write depends on the status:
|
|
245
|
+
|
|
246
|
+
| Status | Use it when | Lines |
|
|
247
|
+
|---|---|---|
|
|
248
|
+
| `done` | This step's work is on the card and you have read it back | `step`, `status`, `next`, `summary`, and `flags` if there are any |
|
|
249
|
+
| `needs-human` | You can't go on without an answer or an approval | `step`, `status`, `question`, `options`, and `summary` if it helps them answer |
|
|
250
|
+
| `answered` | The human has replied to a `needs-human` hand-off | `step`, `status`, `answer` |
|
|
251
|
+
| `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `step`, `status`, `reason` |
|
|
252
|
+
|
|
253
|
+
- **If the command refuses the block, fix what it names and run it again.** If it can't record at all, because the command is missing, you are not in an ocnus space, or it says the hand-off was not recorded, write the block in your message instead and carry on. Don't make a space or install anything to get it to run.
|
|
254
|
+
- **When you stop for the human, end your message with the block the command printed.** At a `needs-human` stop, open your message with a brief: the one the `brief` skill gives, with the question as what is happening now. The brief goes above the block. Between them, or above the block at any other stop, goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
|
|
255
|
+
- **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
|
|
256
|
+
- **`needs-human` is a pause, not an ending.** Wait for the answer. When it comes, record it before anything else, as a hand-off with `status: answered` and what they said in a few words. That is how the time spent waiting on them is told from your own work. Then carry on with this step. The step is over only at `done` or `failed`.
|
|
257
|
+
- **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
|
|
258
|
+
- **After `done`, this step is over.** Record the hand-off before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
|
|
259
|
+
- **After `failed`, change nothing more.** Leave the card as it is for the human.
|
|
260
|
+
|
|
261
|
+
## If something goes wrong
|
|
262
|
+
|
|
263
|
+
| When this happens | Do this |
|
|
264
|
+
|---|---|
|
|
265
|
+
| The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
|
|
266
|
+
| 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` |
|
|
268
|
+
| `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
|
+
| `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
|
+
| 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 |
|
|
272
|
+
| 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
|
+
|
|
274
|
+
If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
|
|
275
|
+
|
|
276
|
+
## Examples
|
|
277
|
+
|
|
278
|
+
**One piece.** The card "Export orders as CSV" has a plan that touches four files and delivers one behaviour.
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
ocnus linear section ABC-122 Breakdown <<'EOF'
|
|
282
|
+
One piece. Four files and one behaviour, small enough for a single pull request.
|
|
283
|
+
EOF
|
|
284
|
+
```
|
|
285
|
+
|
|
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.
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
ocnus linear section ABC-130 Breakdown <<'EOF'
|
|
290
|
+
1. **Staff can add a note to an order**
|
|
291
|
+
- [ ] On an order, a staff member can type a note and save it.
|
|
292
|
+
- [ ] Saved notes show on the order, newest first, with the author and time.
|
|
293
|
+
- [ ] Someone who is not staff can neither add nor see notes.
|
|
294
|
+
2. **Staff can edit and delete their own notes**
|
|
295
|
+
- [ ] A staff member can edit a note they wrote, and the note shows it was edited.
|
|
296
|
+
- [ ] A staff member can delete a note they wrote, after confirming.
|
|
297
|
+
- [ ] A staff member cannot edit or delete someone else's note.
|
|
298
|
+
3. **A note can be shown to the customer**
|
|
299
|
+
- [ ] A staff member can mark a note as visible to the customer.
|
|
300
|
+
- [ ] The customer sees those notes, and only those, on their order page.
|
|
301
|
+
EOF
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**The wrong cut** for the same card:
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
1. Notes table and migration
|
|
308
|
+
2. Notes API
|
|
309
|
+
3. Notes in the staff app
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Nothing can be clicked until the third piece merges, so the first two can't be tested by anyone, and a mistake in the first surfaces two pull requests later.
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdlc-build
|
|
3
|
+
description: Build an approved Linear card in the task that `ocnus task start` made for it, by reading the card's Plan, making the change in the task's worktree, installing what its tests need and running them, and committing on the task's branch, then recording how the build step ended. Use this once a card is approved and its task started, whenever asked to build, implement or code a card in that task, even if the request only says "build ABC-123". It pushes nothing and opens no pull request.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build a card
|
|
7
|
+
|
|
8
|
+
The build step comes after the human has approved the card. Define said what is wanted, plan said how it will be built, and breakdown cut it into pieces the human approved. The build step makes the change that the Plan describes, in the task's worktree, and shows that each Done when item is true.
|
|
9
|
+
|
|
10
|
+
The human is not watching while it runs. They read the commits and the hand-off afterwards, so the commits have to match the Plan, and the hand-off has to say plainly how the build step ended and what it could not show.
|
|
11
|
+
|
|
12
|
+
The build step ends with commits on the task's branch. Push nothing and open no pull request. The review step, pushing and the pull request come after this step.
|
|
13
|
+
|
|
14
|
+
## Before you change anything
|
|
15
|
+
|
|
16
|
+
1. Get the card. If you weren't given a card ID, ask for one.
|
|
17
|
+
2. Read the card with `ocnus linear read <card ID>`: the original description, the Specification, the Plan, the Breakdown, the Review if there is one, and the comments.
|
|
18
|
+
3. If the card has no Plan, plan hasn't run, and the card was not approved to build. Change nothing, and hand off as `failed`, saying so.
|
|
19
|
+
4. If the Breakdown cut the card into several slices, each slice is a sub-issue with a Plan of its own. Build the sub-issue, not this card. Change nothing, and hand off as `failed`, naming the sub-issue that comes first.
|
|
20
|
+
5. Check where you are. The work goes in the task's worktrees, which `ocnus task start` made under the space's `tasks/` folder, one for each repo, all on the task's branch. Run `git branch --show-current` in each one. The branch has to name this card, as in `feat/abc-122-short-name`. If you are in a repo's own checkout, on its default branch, or on a branch for another card, change nothing and hand off as `failed`, saying where you are.
|
|
21
|
+
6. Run `git status` in each worktree. A new task's worktree has no changes. If one has changes that aren't yours, don't touch them: ask the human what to do with them.
|
|
22
|
+
7. If the card has a Review with items not met, this is a later round: the `sdlc-review` skill checked an earlier round and sent it back. Build only what those items need, on top of the commits already there, and leave the items it found met as they are. A test that fails for one of those items is the work, not a reason to ask.
|
|
23
|
+
|
|
24
|
+
## 1. Read how the repo works
|
|
25
|
+
|
|
26
|
+
Read the guidance in each worktree you will change: its `CLAUDE.md`, `AGENTS.md`, `README` and any `CONTRIBUTING` file. Look for four things:
|
|
27
|
+
|
|
28
|
+
- **How a fresh checkout is made ready.** What a new clone has to install before its tests can run, such as its dependencies.
|
|
29
|
+
- **How it is tested.** The command that runs the tests, and how to run only some of them.
|
|
30
|
+
- **How commits are written.** The form of a commit message, and anything a commit must never contain.
|
|
31
|
+
- **Rules for a change like this one.** A file that must not be edited by hand, a list that a new file must be added to, a version that only a release changes.
|
|
32
|
+
|
|
33
|
+
`ocnus task start` installs nothing for now, so a new worktree may have none of what its tests need. If it lacks something, install what the tests need the way the repo's docs say. Install only: start no app, dev server or database. Install into the worktree, as its dependencies are: a tool installed on the machine itself, such as with `brew` or a global `npm install`, is for the human, so ask. Read a command before you run it: if the docs' way of making a checkout ready also starts something, run only the part that installs. If the docs don't say how to install what is missing, ask the human rather than guess. If the tests need something you may not start yourself, such as a database or Docker, ask the human, saying what.
|
|
34
|
+
|
|
35
|
+
Don't run the whole test suite yet. Section 3 runs it once your change is done, and a test that fails then is checked on the default branch there, which tells one you broke from one that was broken already.
|
|
36
|
+
|
|
37
|
+
## 2. Build what the Plan says
|
|
38
|
+
|
|
39
|
+
Work through the Done when items in order, one at a time. In a later round, work through only the items the Review found not met, and start each from what the Review says is missing or fails. For each one:
|
|
40
|
+
|
|
41
|
+
1. Take its test from the Plan's Tests line for that item. Write the test first where the Plan names one, and run it to see it fail for the reason you expect.
|
|
42
|
+
2. Make the change the Plan's Changes list gives for it, in the files it names. Reuse the helpers it names.
|
|
43
|
+
3. Run the test again and see it pass.
|
|
44
|
+
|
|
45
|
+
Run every test command through `ocnus tests run`, whole suite or part, as in `ocnus tests run npm test -- orders`. It runs the command as it is, with its output, its input and its exit code, and while the host is recorded it records the test run as this card's, so that `ocnus host report` can say which test runs loaded the host. Give it the command and its arguments, not a line for a shell: what saves or pipes the output goes after them, as in `ocnus tests run npm test > <file> 2>&1`, and a `cd` goes before it.
|
|
46
|
+
|
|
47
|
+
Each path in Changes starts with the repo's name, and that repo's worktree is the folder of the same name in the task. A task with one repo is its worktree.
|
|
48
|
+
|
|
49
|
+
Stay inside the Plan. The human approved this Plan, not a better one you could write now:
|
|
50
|
+
|
|
51
|
+
- **The code differs from the Plan in a detail** that changes nothing they approved, such as a helper with another name or a file that moved. Follow the code, and say so in the summary when you hand off.
|
|
52
|
+
- **The Plan can't be built as written.** Following it would change what they approved: a Done when item that can't be met, a different approach, a new dependency, or a repo the task has no worktree of. Ask the human before going any further, in a handoff block with `status: needs-human` and your recommendation first in `options`.
|
|
53
|
+
- **Something outside the Plan.** You may find a nearby bug, a missing test or a refactor that would help. Leave it alone and put it in `flags` when you hand off.
|
|
54
|
+
|
|
55
|
+
The build step changes nothing on the card. The hand-off records how it ended.
|
|
56
|
+
|
|
57
|
+
## 3. Run the tests
|
|
58
|
+
|
|
59
|
+
When every Done when item has its change, run the repo's whole test suite, in every worktree you changed. It is the build step's first whole run. Run it through `ocnus tests run`, as section 2 says, as in `ocnus tests run npm test`. The build step is done only when the tests pass, but for any test the human let stand, as below. Run it once, and keep what it prints, in a file if it is long, rather than running it again to read another part of it.
|
|
60
|
+
|
|
61
|
+
If a test fails, find out why and fix it. Change a test only when the Plan changes what that test checks. A test made to pass by weakening it is a failure you have hidden from the human.
|
|
62
|
+
|
|
63
|
+
When a test fails that your change doesn't explain, find out whether it fails on the default branch too, without touching the task's worktree:
|
|
64
|
+
|
|
65
|
+
1. Make a folder for it with `mktemp -d`, and note the folder it prints.
|
|
66
|
+
2. Find the default branch's commit that the task's branch holds, with `git merge-base HEAD origin/<default branch>`. `git symbolic-ref --short refs/remotes/origin/HEAD` names the default branch, as `origin/<branch>`. A repo with no `origin` uses its own default branch, such as `main`. The commit is the one the task started from, or, after a conflict merge, the one the merge took in.
|
|
67
|
+
3. Make the throwaway worktree with `git worktree add --detach <the folder> <that commit>`. Where the repo has submodules, run `git submodule update --init` in it. Copy into it any file the human put in the task's worktree for the tests, such as an ignored `.env.test`.
|
|
68
|
+
4. Install there what the tests need, as section 1 says, and run only the part of the suite that holds the test, or the whole suite where the repo can't run less, through `ocnus tests run` there too.
|
|
69
|
+
5. Remove it with `git worktree remove <the folder>`, naming the folder `mktemp -d` printed, never the task's worktree. Don't add `--force`: if git refuses, leave the folder, and say so in `flags`.
|
|
70
|
+
|
|
71
|
+
If it fails there the same way, with the same error, it was broken before this card. Ask the human whether to build on top of it, in a handoff block with `status: needs-human`, and don't fix it as part of this card. If it passes there, your change broke it: fix it. If it fails there for another reason, such as a missing module or setting, the throwaway is not set up as the task's worktree is: set it up and run it again, and if you can't, ask the human, giving both errors.
|
|
72
|
+
|
|
73
|
+
When the human says to build on top of it, it is a test the human let stand. From then on, the tests pass when every other test passes, in this step and in the review step and the pr step after it. Name each test the human let stand in `flags` when you hand off. When they say not to, hand off as `failed`, with the test in `reason`.
|
|
74
|
+
|
|
75
|
+
In a later round, the tests the Review found failing are what you are here to fix, but for any the human let stand. Check on the default branch only a test that fails for some other reason.
|
|
76
|
+
|
|
77
|
+
If the tests can't run at all because something they need is missing, install it as section 1 says, then run them again. If it is something you may not start yourself, ask the human, saying what.
|
|
78
|
+
|
|
79
|
+
## 4. Commit
|
|
80
|
+
|
|
81
|
+
Commit on the task's branch, in each worktree you changed, by the repo's own rules for commits. Where the repo has none, write a Conventional Commits message whose type is the card's type, such as `feat: export orders as CSV`.
|
|
82
|
+
|
|
83
|
+
- Commit only when the tests pass.
|
|
84
|
+
- Leave nothing behind: `git status` shows no changes when you are done.
|
|
85
|
+
- Don't skip the repo's commit hooks. If a hook refuses the commit, fix what it names, run the whole suite again, since the fix changed what was tested, and commit again.
|
|
86
|
+
- Push nothing and open no pull request.
|
|
87
|
+
|
|
88
|
+
## 5. Hand off
|
|
89
|
+
|
|
90
|
+
When the commits are made and the tests pass, record the hand-off. The build step is not finished until it is recorded:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
ocnus task handoff <space> <card ID> <<'EOF'
|
|
94
|
+
step: build
|
|
95
|
+
status: done
|
|
96
|
+
next: review
|
|
97
|
+
summary: <what was built, in which repos, how many commits, and that the tests pass; any detail where you followed the code rather than the Plan>
|
|
98
|
+
flags: <any Done when item you could not show to be true, and why; anything you found outside the Plan>
|
|
99
|
+
EOF
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Put your own words in place of each hint in angle brackets, and leave the `flags` line out when there is nothing to flag. Hand off as `done` only when the tests pass. When they can't be made to pass, or something is missing, hand off as `failed`, with what is wrong and what you tried in `reason`, and leave the work as it is for the human.
|
|
103
|
+
|
|
104
|
+
In a later round, say in `summary` what was done for each item the Review found not met. The step that follows is the review step, which the `sdlc-review` skill runs: it checks the work against the card's Done when, and sends what is not met back here as a later round.
|
|
105
|
+
|
|
106
|
+
## The handoff block
|
|
107
|
+
|
|
108
|
+
Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
|
|
109
|
+
|
|
110
|
+
Record a hand-off every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Record it even when you go straight on to another step, because the record is what shows this one ended. Run `ocnus task handoff` with the block on stdin, one value per line:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
ocnus task handoff <space> <card ID> <<'EOF'
|
|
114
|
+
step: <this step>
|
|
115
|
+
status: <done, needs-human or failed>
|
|
116
|
+
next: <the step that follows>
|
|
117
|
+
summary: <one to three sentences on what you did>
|
|
118
|
+
flags: <what the human should know but wasn't asked>
|
|
119
|
+
question: <one question>
|
|
120
|
+
options: <the answers you expect, your recommendation first, separated by " | ">
|
|
121
|
+
answer: <what the human said, in a few words>
|
|
122
|
+
reason: <what went wrong, and what you already tried>
|
|
123
|
+
EOF
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`<space>` is the ocnus space this session is in. The `step:` line names this step. The words in angle brackets are hints: put your own in their place. The command checks the block, records it and prints it back. Which lines you write depends on the status:
|
|
127
|
+
|
|
128
|
+
| Status | Use it when | Lines |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| `done` | This step's work is on the card and you have read it back | `step`, `status`, `next`, `summary`, and `flags` if there are any |
|
|
131
|
+
| `needs-human` | You can't go on without an answer or an approval | `step`, `status`, `question`, `options`, and `summary` if it helps them answer |
|
|
132
|
+
| `answered` | The human has replied to a `needs-human` hand-off | `step`, `status`, `answer` |
|
|
133
|
+
| `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `step`, `status`, `reason` |
|
|
134
|
+
|
|
135
|
+
- **If the command refuses the block, fix what it names and run it again.** If it can't record at all, because the command is missing, you are not in an ocnus space, or it says the hand-off was not recorded, write the block in your message instead and carry on. Don't make a space or install anything to get it to run.
|
|
136
|
+
- **When you stop for the human, end your message with the block the command printed.** At a `needs-human` stop, open your message with a brief: the one the `brief` skill gives, with the question as what is happening now. The brief goes above the block. Between them, or above the block at any other stop, goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
|
|
137
|
+
- **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
|
|
138
|
+
- **`needs-human` is a pause, not an ending.** Wait for the answer. When it comes, record it before anything else, as a hand-off with `status: answered` and what they said in a few words. That is how the time spent waiting on them is told from your own work. Then carry on with this step. The step is over only at `done` or `failed`.
|
|
139
|
+
- **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
|
|
140
|
+
- **After `done`, this step is over.** Record the hand-off before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
|
|
141
|
+
- **After `failed`, change nothing more.** Leave the card as it is for the human.
|
|
142
|
+
|
|
143
|
+
## If something goes wrong
|
|
144
|
+
|
|
145
|
+
| When this happens | Do this |
|
|
146
|
+
|---|---|
|
|
147
|
+
| The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
|
|
148
|
+
| The Linear tools aren't available | Hand off as `failed`. Don't build from memory of the card or from its title |
|
|
149
|
+
| `ocnus linear read` says no Linear key is saved or that Linear rejected the key, or the command isn't there | Read the card with the Linear tools instead, and say so in `flags` when you hand off |
|
|
150
|
+
| A repo the Plan changes has no worktree in the task | Ask the human. The task may have been started with targets that left it out |
|
|
151
|
+
| A path in the Plan doesn't exist | Find the real one. If there isn't one, and the file isn't marked as new, ask the human |
|
|
152
|
+
| The worktree lacks what the tests need, and the repo's docs don't say how to install it | Ask the human what to install. Don't guess |
|
|
153
|
+
| An install fails | Ask the human, with the command and its error. Don't change the repo's files to make it install |
|
|
154
|
+
| The tests need an app, server, database or Docker running | Ask the human, saying what. Don't start it yourself |
|
|
155
|
+
| A test that fails at the end fails on the default branch too | Ask the human whether to build on top of it. Don't fix it as part of this card |
|
|
156
|
+
| A commit hook refuses the commit | Fix what it names and commit again. Never skip the hook |
|
|
157
|
+
| Tests the human did not let stand still fail after you have tried what you can | Hand off as `failed`, with the failing tests and what you tried. Leave the work uncommitted in the worktree |
|
|
158
|
+
|
|
159
|
+
If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
|
|
160
|
+
|
|
161
|
+
## Example
|
|
162
|
+
|
|
163
|
+
**From the card's Plan**
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
**Tests:**
|
|
167
|
+
1. Button shows for a manager: component test in `OrdersPage.test.tsx`
|
|
168
|
+
2. Columns, and one row per order: API test in `test_orders_export.py`
|
|
169
|
+
3. Same filters and range as on screen: API test with a filtered request, and a component test that the filters are passed
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**The hand-off at the end**
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
ocnus task handoff shop ABC-122 <<'EOF'
|
|
176
|
+
step: build
|
|
177
|
+
status: done
|
|
178
|
+
next: review
|
|
179
|
+
summary: Installed each worktree's dependencies as its README says, then built the CSV export in api and the Download CSV button in web, in two commits. Both test suites pass. The CSV helper is csv_rows in shop/api/app/common/export.py, not csv_stream as the Plan said.
|
|
180
|
+
flags: The orders page's tests can't set its filters yet, so item 3 is shown by the API test alone. The orders list also ignores the date range on page 2, which is outside this card.
|
|
181
|
+
EOF
|
|
182
|
+
```
|