@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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +988 -2
  3. package/agents/linear-mcp.json +1 -0
  4. package/agents/ocnus-build.md +23 -0
  5. package/agents/ocnus-write-up.md +20 -0
  6. package/cli/host-mark +36 -0
  7. package/cli/lib/agents.sh +350 -0
  8. package/cli/lib/approval.sh +94 -0
  9. package/cli/lib/archive.sh +447 -0
  10. package/cli/lib/billing.sh +166 -0
  11. package/cli/lib/close.sh +189 -0
  12. package/cli/lib/commands.sh +220 -0
  13. package/cli/lib/common.sh +215 -0
  14. package/cli/lib/finish.sh +288 -0
  15. package/cli/lib/github.sh +162 -0
  16. package/cli/lib/guard.sh +134 -0
  17. package/cli/lib/handoff.sh +551 -0
  18. package/cli/lib/host.sh +1802 -0
  19. package/cli/lib/linear.sh +1389 -0
  20. package/cli/lib/links.sh +135 -0
  21. package/cli/lib/merges.sh +853 -0
  22. package/cli/lib/recipes.sh +54 -0
  23. package/cli/lib/settings.sh +465 -0
  24. package/cli/lib/space.sh +343 -0
  25. package/cli/lib/task.sh +847 -0
  26. package/cli/lib/tests.sh +268 -0
  27. package/cli/lib/trust.sh +70 -0
  28. package/cli/ocnus +630 -0
  29. package/herdr/README.md +2238 -0
  30. package/herdr/layouts/default.json +259 -0
  31. package/herdr/mods/agent-settings/cog.svg +4 -0
  32. package/herdr/mods/agent-settings/main.js +356 -0
  33. package/herdr/mods/agent-settings/mod.json +1 -0
  34. package/herdr/mods/cards/main.js +450 -0
  35. package/herdr/mods/cards/mod.json +1 -0
  36. package/herdr/mods/cards/refresh.svg +4 -0
  37. package/herdr/mods/cpu/main.js +90 -0
  38. package/herdr/mods/cpu/mod.json +1 -0
  39. package/herdr/mods/layout-switch/main.js +48 -0
  40. package/herdr/mods/layout-switch/mod.json +1 -0
  41. package/herdr/mods/names/main.js +69 -0
  42. package/herdr/mods/names/mod.json +1 -0
  43. package/herdr/mods/ocnus-spaces/main.js +376 -0
  44. package/herdr/mods/ocnus-spaces/mod.json +1 -0
  45. package/herdr/mods/steps/main.js +354 -0
  46. package/herdr/mods/steps/mod.json +1 -0
  47. package/herdr/spaces/template/SPACE.md +19 -0
  48. package/package.json +27 -4
  49. package/prompts/task-build.md +11 -0
  50. package/prompts/task-new.md +17 -0
  51. package/skills/brief/SKILL.md +64 -0
  52. package/skills/sdlc-breakdown/SKILL.md +312 -0
  53. package/skills/sdlc-build/SKILL.md +182 -0
  54. package/skills/sdlc-define/SKILL.md +203 -0
  55. package/skills/sdlc-plan/SKILL.md +202 -0
  56. package/skills/sdlc-pr/SKILL.md +339 -0
  57. package/skills/sdlc-review/SKILL.md +227 -0
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: sdlc-define
3
+ description: Fill out a Linear card from its title and short description by setting its type label and writing its Specification (Why, Done when, Out of scope). Use this as the first step on any card that has no Specification yet, and whenever asked to define, spec, scope or write up a card, even if the request only says "start on ABC-123" and the card is still just a title and a sentence or two.
4
+ ---
5
+
6
+ # Define a card
7
+
8
+ Define is the first step of the lifecycle. It takes a card that holds a title and a sentence or two, and leaves it with a type and a Specification that says what is wanted and how anyone can tell it is done.
9
+
10
+ Everything after this step is checked against the Specification. Plan maps its tests to Done when, breakdown cuts along it, the build step is finished when it is true, and the human reads it to approve the card. A vague Specification doesn't slow an agent down. It gets built as whatever the agent guessed.
11
+
12
+ Define says what and why. How it will be built belongs to plan, and whether it is one piece or several belongs to breakdown. Leave both alone here.
13
+
14
+ ## Before you write 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>`: title, description, labels and comments.
18
+ 3. If the card already has a Specification section, don't write a second one. If the human has asked for it to be revised, revise it in place, with `--replace` (see section 4). Otherwise tell the human and ask whether they want it revised, and if they don't, hand off as `done` without changing it.
19
+ 4. Read the space's `SPACE.md`, or its `PROJECT.md` on a machine set up before (the space's `CLAUDE.md` links to whichever it has), and look at only enough of the product, docs and code to use the right names and to know what exists today. Stop there. Working out the approach is plan's job, and doing it now tends to leak files and design into the Specification.
20
+
21
+ ## 1. Set the type
22
+
23
+ Every card gets exactly one type. The types come from Conventional Branch, because the type becomes the branch prefix.
24
+
25
+ | Type | Use it when the change… |
26
+ |---|---|
27
+ | `feat` | adds behaviour a user, admin or agent can use |
28
+ | `fix` | corrects behaviour that was broken |
29
+ | `chore` | is neither: a refactor, docs, tests, tooling, infrastructure or a dependency update |
30
+
31
+ - If two could fit, take the first that does, in this order: `fix`, `feat`, `chore`.
32
+ - Work the type out from the title and description even when the card already carries a type label. Labels get added by habit and are often wrong. Replace the label if yours differs.
33
+ - Set it as the card's label in the `Type` label group, which allows one per card, with this command:
34
+
35
+ ```
36
+ ocnus linear type <card ID> <type>
37
+ ```
38
+
39
+ It takes any other type off the card and keeps the card's other labels. The name is lowercase and exact, because `ocnus task start` uses it as the branch prefix: `<type>/<card-id>-<short-name>`, for example `feat/abc-122-export-orders`.
40
+ - If the work is really two types, such as a fix plus an unrelated clean-up, this card keeps its main change. Tell the human about the other part and ask whether they want a second card for it. Don't create that card yourself.
41
+
42
+ The type is a label only. Don't write it into the card's text.
43
+
44
+ ## 2. Write the Specification
45
+
46
+ It has three parts.
47
+
48
+ ### Why
49
+
50
+ One or two lines on the reason. How it reads depends on the type.
51
+
52
+ | Type | Why reads as |
53
+ |---|---|
54
+ | `feat` | A story: who can now do what, so that why |
55
+ | `fix` | What is broken and who it affects, with how to reproduce it, what was expected and what happens |
56
+ | `chore` | What is awkward, missing or out of date, and why now. For a refactor, also what must stay the same |
57
+
58
+ ### Done when
59
+
60
+ A checklist of three to seven items. A small chore can have fewer. Each item is something a reviewer can check without asking you what you meant.
61
+
62
+ - **Describe an outcome, not work.** "A manager can download this month's orders as a CSV" is an outcome. "Add an export endpoint" is work, and it can be finished while the outcome is still false.
63
+ - **Make it pass or fail.** "The page loads quickly" can't fail. "The orders page shows within two seconds on the seed data" can.
64
+ - **Make each item checkable alone.** If two things have to be checked together, they are one item.
65
+ - **Cover the unhappy path that matters.** Think about the empty state, bad input and someone without permission, and include the ones a user would actually hit.
66
+ - **Turn needs like speed or access into items.** Agents build what the list says. A need that isn't on the list won't be met on purpose.
67
+ - **A fix always includes** "A test fails before the fix and passes after." That is what shows the bug was real and is gone.
68
+ - **A change that shouldn't alter behaviour, such as a refactor, always includes** "Existing tests pass without being changed." That is what shows behaviour didn't move.
69
+ - **Don't split by layer.** An API change and the screen that depends on it belong on the same card. A card that stops at the API can't be checked by anyone using the product.
70
+
71
+ If you end up with more than seven items, the card is probably more than one thing. Write the items anyway and say so in `flags` when you hand off. Breakdown deals with it after plan.
72
+
73
+ ### Out of scope
74
+
75
+ Include this only when a reader would reasonably expect something that this card will not do. Otherwise leave it out.
76
+
77
+ ## 3. When to ask the human
78
+
79
+ Ask in the session and wait for the answer when:
80
+
81
+ - The title and description aren't enough to say who this is for or what done looks like.
82
+ - An item depends on a product decision or a fact only they have, such as a limit, a wording, or which users.
83
+ - There are two readings that would give different Done when lists.
84
+
85
+ Ask one question at a time, in a handoff block with `status: needs-human`. Put your best guess first in `options`, so they can answer with a yes. Don't fill a gap with a guess or a placeholder. A made-up criterion reads exactly like a real one, and it will be built.
86
+
87
+ ## 4. Write it to the card
88
+
89
+ - Leave the original description exactly as it is, at the top. It is the original ask, and later steps read it.
90
+ - Append the Specification below it as a collapsible section, so the card stays short when the human opens it.
91
+ - Add nothing else. No type line, repo, risk or flags, and no approach or file names.
92
+
93
+ Write it with this command, the section's body on stdin:
94
+
95
+ ```
96
+ ocnus linear section <card ID> Specification <<'EOF'
97
+ **Why:** …
98
+
99
+ **Done when:**
100
+ - [ ] …
101
+ - [ ] …
102
+
103
+ **Out of scope:** …
104
+ EOF
105
+ ```
106
+
107
+ The command adds the heading and the folding, puts the section below the description, and leaves the description as it is. To revise a Specification the human asked you to change, run it with `--replace` after the section name. It reads the card back before it says it is done: when it says it added the Specification, the write is checked, and you don't need to read the card again.
108
+
109
+ ## 5. Hand off
110
+
111
+ When the Specification is on the card and you have read it back, record the hand-off. Define is not finished until it is recorded:
112
+
113
+ ```
114
+ ocnus task handoff <space> <card ID> <<'EOF'
115
+ step: define
116
+ status: done
117
+ next: plan
118
+ summary: <the type you set, whether you replaced a label that was already there, and how many Done when items there are>
119
+ flags: <anything you weren't sure about, and whether the card looks like more than one thing>
120
+ EOF
121
+ ```
122
+
123
+ Put your own words in place of each hint in angle brackets, and leave the `flags` line out when there is nothing to flag.
124
+
125
+ ## The handoff block
126
+
127
+ 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.
128
+
129
+ 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:
130
+
131
+ ```
132
+ ocnus task handoff <space> <card ID> <<'EOF'
133
+ step: <this step>
134
+ status: <done, needs-human or failed>
135
+ next: <the step that follows>
136
+ summary: <one to three sentences on what you did>
137
+ flags: <what the human should know but wasn't asked>
138
+ question: <one question>
139
+ options: <the answers you expect, your recommendation first, separated by " | ">
140
+ answer: <what the human said, in a few words>
141
+ reason: <what went wrong, and what you already tried>
142
+ EOF
143
+ ```
144
+
145
+ `<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:
146
+
147
+ | Status | Use it when | Lines |
148
+ |---|---|---|
149
+ | `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 |
150
+ | `needs-human` | You can't go on without an answer or an approval | `step`, `status`, `question`, `options`, and `summary` if it helps them answer |
151
+ | `answered` | The human has replied to a `needs-human` hand-off | `step`, `status`, `answer` |
152
+ | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `step`, `status`, `reason` |
153
+
154
+ - **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.
155
+ - **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.
156
+ - **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`.
157
+ - **`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`.
158
+ - **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.
159
+ - **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.
160
+ - **After `failed`, change nothing more.** Leave the card as it is for the human.
161
+
162
+ ## If something goes wrong
163
+
164
+ | When this happens | Do this |
165
+ |---|---|
166
+ | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
167
+ | 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 |
168
+ | `ocnus linear` says no Linear key is saved or that Linear rejected the key, or the command isn't there | Read the card, set the type and write the section with the Linear tools instead, in the same form, with the heading `>>> ## Specification` and a closing `>>>`. Say so in `flags` |
169
+ | `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 Specification, the first try got through |
170
+ | `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 |
171
+ | The collapsed section shows as plain `>>>` text | Leave the content as it is and tell the human. Don't keep reformatting it |
172
+ | `ocnus linear type` says the label it needs doesn't exist | Don't create it. Finish the Specification, and tell the human which label is missing |
173
+ | The card carries more than one type label | `ocnus linear type` leaves only the one you give it |
174
+
175
+ If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
176
+
177
+ ## Example
178
+
179
+ **The card arrives as**
180
+
181
+ > **Export orders as CSV**
182
+ > Managers keep asking for the raw order list so they can work on it in a spreadsheet. Let them download it.
183
+
184
+ **Type:** `feat`, set as the label with `ocnus linear type ABC-122 feat`.
185
+
186
+ **Written to the card**
187
+
188
+ ```
189
+ ocnus linear section ABC-122 Specification <<'EOF'
190
+ **Why:** A manager can download the order list as a CSV, so they can analyse it in their own spreadsheet.
191
+
192
+ **Done when:**
193
+ - [ ] On the orders page, a manager sees a Download CSV button.
194
+ - [ ] The file has one row per order, with the order number, date, customer, status and total.
195
+ - [ ] The file covers the same filters and date range that are showing on screen.
196
+ - [ ] With no orders in range, the file has the header row and no others.
197
+ - [ ] Someone who is not a manager does not see the button and cannot fetch the file.
198
+
199
+ **Out of scope:** Scheduled or emailed exports.
200
+ EOF
201
+ ```
202
+
203
+ Notice what isn't there: no endpoint, no file names, no library. Those are plan's.
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: sdlc-plan
3
+ description: Write the technical plan for a Linear card that already has a Specification by reading the card and the code, then appending a Plan (Approach, Changes, Tests) to the card. Use this after define and before breakdown, and whenever asked to plan a card, scope it technically or work out how to build it, even if the request only says "plan ABC-123" or "how would we build this one".
4
+ ---
5
+
6
+ # Plan a card
7
+
8
+ Plan is the second step of the lifecycle. Define said what is wanted. Plan reads the code and says how it will be built: the approach, the files that change, and how each Done when item will be shown to be true.
9
+
10
+ Two readers depend on it. The human reads it to approve the card, so it has to be short and honest. The build step starts later in a fresh session with only the card, so the plan has to be exact enough to build from cold. A plan that says "update the orders module" helps neither of them.
11
+
12
+ Plan only reads. It writes no code and makes no branch or worktree. Whether the card is one piece or several is breakdown's job, which comes next.
13
+
14
+ ## Before you write anything
15
+
16
+ 1. Read the card with `ocnus linear read <card ID>`: the original description and the Specification.
17
+ 2. If there is no Specification, define hasn't run. Say so and stop.
18
+ 3. If the card already has a Plan section, don't write a second one. If the human has asked for it to be revised, revise it in place. Otherwise tell the human and ask whether they want it revised, and if they don't, hand off as `done` without changing it.
19
+
20
+ ## 1. Read the code
21
+
22
+ Start from the space's `SPACE.md`, or its `PROJECT.md` on a machine set up before (the space's `CLAUDE.md` links to whichever it has). Its sections on what each repo owns tell you where this work belongs.
23
+
24
+ Then read until you could explain the change to someone who knows the codebase:
25
+
26
+ - **The guidance above the code you expect to touch.** Read the `CLAUDE.md`, `AGENTS.md` or `.ai/` files on the path down to those files. They hold conventions you can't infer from one file.
27
+ - **Where similar work already lives.** Find the closest existing feature and read it end to end. The best plan is usually "built like that one".
28
+ - **What you can reuse.** Look for shared helpers, components and test utilities before planning a new one.
29
+ - **How it is tested.** Find the tests for the closest feature, and note the level they work at and how they are set up.
30
+
31
+ The repo clones linked into the space are shared reference copies. Don't switch branches or edit anything in them. Fetch first, and if a clone isn't on an up-to-date base branch, read from the remote base branch with git instead of from the working files.
32
+
33
+ ## 2. Write the Plan
34
+
35
+ It has three parts.
36
+
37
+ ### Approach
38
+
39
+ A few sentences on how it will be built. Name the existing pattern it follows and where that pattern lives.
40
+
41
+ - If you chose between two real options, add one line on the one you rejected and why. It saves the human asking.
42
+ - If the work needs a new dependency, say so here. That is a decision the human should see.
43
+ - If the work needs more than one repo, say which and why.
44
+
45
+ ### Changes
46
+
47
+ The files you expect to touch, grouped by app or package. Give each one a few words on what changes.
48
+
49
+ - Write each path from the repo root, starting with the repo's name, so the repo never needs stating separately.
50
+ - Mark new files as new.
51
+ - Include the unglamorous ones: migrations, config, seed data, docs.
52
+ - Name the helpers you will reuse.
53
+ - Check that every existing path you write is real. A path you guessed reads exactly like one you checked, and the build step will trust it.
54
+
55
+ This is a list of where and what, not code. Don't write the implementation.
56
+
57
+ ### Tests
58
+
59
+ One line for each Done when item, in the same order, saying how it will be shown to be true.
60
+
61
+ - Prefer a test, and say what level it works at and which file it goes in.
62
+ - Where a test can't prove the item, say what will: a screenshot, or the output of a command.
63
+ - Every Done when item gets a line. An item with no line is an item nobody will check.
64
+ - For a fix, the first test reproduces the bug and fails before the change.
65
+ - For a change that shouldn't alter behaviour, name the existing tests that cover it. No new ones are needed.
66
+
67
+ ## 3. Stay inside the Specification
68
+
69
+ Plan never edits the Specification or the original description. They are what the human asked for, and the plan answers to them.
70
+
71
+ - **A Done when item can't be met as written.** The code may show that an item is impossible, contradicts how the product works, or costs far more than the card suggests. Ask the human before going any further, in a handoff block with `status: needs-human`. They may change the Specification. You may not.
72
+ - **A technical question.** Settle it from the code where you can. Ask the human only what the code can't answer, such as an upcoming change that affects the approach, or a choice between two workable options with different costs. Ask one question at a time, in a handoff block with `status: needs-human` and your recommendation first in `options`.
73
+ - **Something outside the Specification.** While reading you may find a nearby bug, a missing test or a refactor that would help. Leave it out of the plan and put it in `flags` when you hand off. Folding it in makes the card bigger than what they approved.
74
+
75
+ ## 4. Write it to the card
76
+
77
+ - Append the Plan below the Specification as a collapsible section.
78
+ - Change nothing above it.
79
+ - Add nothing else: no repo line, no risk, no open questions.
80
+
81
+ Write it with this command, the section's body on stdin:
82
+
83
+ ```
84
+ ocnus linear section <card ID> Plan <<'EOF'
85
+ **Approach:** …
86
+
87
+ **Changes:**
88
+ - `repo/path/to/file`: what changes
89
+ - `repo/path/to/new-file` (new): what it holds
90
+
91
+ **Tests:**
92
+ 1. <Done when item, in a few words>: how it is shown
93
+ 2. …
94
+ EOF
95
+ ```
96
+
97
+ The command adds the heading and the folding, puts the Plan below what is on the card, and leaves everything above it as it is. To revise a Plan the human asked you to change, run it with `--replace` after the section name. It reads the card back before it says it is done: when it says it added the Plan, the write is checked, and you don't need to read the card again.
98
+
99
+ ## 5. Hand off
100
+
101
+ When the Plan is on the card and you have read it back, record the hand-off. Plan is not finished until it is recorded:
102
+
103
+ ```
104
+ ocnus task handoff <space> <card ID> <<'EOF'
105
+ step: plan
106
+ status: done
107
+ next: breakdown
108
+ summary: <the approach in one sentence, roughly how many files it touches and in which apps or repos, and whether it looks like one pull request's worth or more>
109
+ flags: <anything you found that sits outside the Specification>
110
+ EOF
111
+ ```
112
+
113
+ Put your own words in place of each hint in angle brackets, and leave the `flags` line out when there is nothing to flag. Breakdown decides whether it is one pull request or more, but your read is useful.
114
+
115
+ ## The handoff block
116
+
117
+ 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.
118
+
119
+ 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:
120
+
121
+ ```
122
+ ocnus task handoff <space> <card ID> <<'EOF'
123
+ step: <this step>
124
+ status: <done, needs-human or failed>
125
+ next: <the step that follows>
126
+ summary: <one to three sentences on what you did>
127
+ flags: <what the human should know but wasn't asked>
128
+ question: <one question>
129
+ options: <the answers you expect, your recommendation first, separated by " | ">
130
+ answer: <what the human said, in a few words>
131
+ reason: <what went wrong, and what you already tried>
132
+ EOF
133
+ ```
134
+
135
+ `<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:
136
+
137
+ | Status | Use it when | Lines |
138
+ |---|---|---|
139
+ | `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 |
140
+ | `needs-human` | You can't go on without an answer or an approval | `step`, `status`, `question`, `options`, and `summary` if it helps them answer |
141
+ | `answered` | The human has replied to a `needs-human` hand-off | `step`, `status`, `answer` |
142
+ | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `step`, `status`, `reason` |
143
+
144
+ - **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.
145
+ - **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.
146
+ - **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`.
147
+ - **`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`.
148
+ - **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.
149
+ - **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.
150
+ - **After `failed`, change nothing more.** Leave the card as it is for the human.
151
+
152
+ ## If something goes wrong
153
+
154
+ | When this happens | Do this |
155
+ |---|---|
156
+ | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
157
+ | 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 |
158
+ | `ocnus linear` says no Linear key is saved or that Linear rejected the key, or the command isn't there | Read the card and write the section with the Linear tools instead, in the same form, with the heading `>>> ## Plan` and a closing `>>>`. Say so in `flags` |
159
+ | `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 Plan, the first try got through |
160
+ | `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 |
161
+ | The collapsed section shows as plain `>>>` text | Leave the content as it is and tell the human. Don't keep reformatting it |
162
+ | A repo named in the space's doc is missing, or the fetch fails | Tell the human, and ask whether to plan from what is on disk |
163
+ | You can't tell which repo the work belongs in | Ask the human. Don't guess paths |
164
+ | A path you were about to write doesn't exist | Find the real one, or mark the file as new. Never leave a path you haven't checked |
165
+
166
+ If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
167
+
168
+ ## Example
169
+
170
+ **The card's Specification**
171
+
172
+ ```
173
+ **Why:** A manager can download the order list as a CSV, so they can analyse it in their own spreadsheet.
174
+
175
+ **Done when:**
176
+ - [ ] On the orders page, a manager sees a Download CSV button.
177
+ - [ ] The file has one row per order, with the order number, date, customer, status and total.
178
+ - [ ] The file covers the same filters and date range that are showing on screen.
179
+ - [ ] With no orders in range, the file has the header row and no others.
180
+ - [ ] Someone who is not a manager does not see the button and cannot fetch the file.
181
+ ```
182
+
183
+ **Written to the card**
184
+
185
+ ```
186
+ ocnus linear section ABC-122 Plan <<'EOF'
187
+ **Approach:** Add a CSV response to the existing orders list endpoint, and a button on the orders page that calls it with the filters currently applied. This follows the invoice export, which already streams a CSV the same way. A separate export endpoint was rejected because it would duplicate the list endpoint's filtering.
188
+
189
+ **Changes:**
190
+ - `shop/api/app/orders/routes.py`: accept `format=csv` on the list route, managers only
191
+ - `shop/api/app/orders/export.py` (new): turn the filtered query into CSV rows, reusing `csv_stream` from `shop/api/app/common/export.py`
192
+ - `shop/web/src/pages/orders/OrdersPage.tsx`: Download CSV button, shown to managers, passing the current filters
193
+ - `shop/web/src/api/orders.ts`: `downloadOrdersCsv(filters)`
194
+
195
+ **Tests:**
196
+ 1. Button shows for a manager: component test in `OrdersPage.test.tsx`
197
+ 2. Columns, and one row per order: API test in `test_orders_export.py`
198
+ 3. Same filters and range as on screen: API test with a filtered request, and a component test that the filters are passed
199
+ 4. Empty range gives the header only: API test in `test_orders_export.py`
200
+ 5. A non-manager can't see or fetch it: component test for the button, API test for a 403
201
+ EOF
202
+ ```