wb-flow 1.0.0-r01

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 (48) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +21 -0
  3. package/README.md +128 -0
  4. package/assets/demo.gif +0 -0
  5. package/bin/install.js +175 -0
  6. package/bin/link.js +71 -0
  7. package/bin/verify-wrappers.js +49 -0
  8. package/package.json +56 -0
  9. package/templates/commands/_shared/output_conventions.md +433 -0
  10. package/templates/commands/_shared/wb_universal_agent_instructions.md +72 -0
  11. package/templates/commands/model_recommendation_updates.md +74 -0
  12. package/templates/commands/model_recommendations.md +112 -0
  13. package/templates/commands/wbActOn/wbActOn_template.md +546 -0
  14. package/templates/commands/wbAudit/wbAudit_template.md +315 -0
  15. package/templates/commands/wbBroadcast/wbBroadcast_template.md +133 -0
  16. package/templates/commands/wbCheck/wbCheck_template.md +322 -0
  17. package/templates/commands/wbClean/wbClean_template.md +118 -0
  18. package/templates/commands/wbContext/wbContext_template.md +213 -0
  19. package/templates/commands/wbDebug/wbDebug_template.md +132 -0
  20. package/templates/commands/wbDeploy/wbDeploy_template.md +224 -0
  21. package/templates/commands/wbDoc/wbDoc_template.md +138 -0
  22. package/templates/commands/wbExplain/wbExplain_template.md +98 -0
  23. package/templates/commands/wbGit/wbGit_template.md +160 -0
  24. package/templates/commands/wbHelp/wbHelp_template.md +101 -0
  25. package/templates/commands/wbIdea/wbIdea_template.md +337 -0
  26. package/templates/commands/wbLicense/wbLicense_template.md +148 -0
  27. package/templates/commands/wbMonetize/wbMonetize_template.md +113 -0
  28. package/templates/commands/wbNext/wbNext_template.md +270 -0
  29. package/templates/commands/wbPlan/wbPlan_template.md +413 -0
  30. package/templates/commands/wbPublish/wbPublish_template.md +205 -0
  31. package/templates/commands/wbRefactor/wbRefactor_template.md +129 -0
  32. package/templates/commands/wbRelease/wbRelease_template.md +229 -0
  33. package/templates/commands/wbReview/wbReview_template.md +252 -0
  34. package/templates/commands/wbSecure/wbSecure_template.md +157 -0
  35. package/templates/commands/wbSetup/wbSetup_template.md +203 -0
  36. package/templates/commands/wbStandup/wbStandup_template.md +198 -0
  37. package/templates/commands/wbTest/wbTest_template.md +226 -0
  38. package/templates/commands/wbToWBC/wbToWBC_template.md +91 -0
  39. package/templates/commands/wbTrack/wbTrack_template.md +555 -0
  40. package/templates/commands/wbTranslate/wbTranslate_template.md +114 -0
  41. package/templates/commands/wbValid/wbValid_template.md +142 -0
  42. package/templates/commands/wbVision/wbVision_template.md +141 -0
  43. package/templates/commands/wbWork/wbWork_template.md +140 -0
  44. package/templates/commands/wb_commands_reference.claude.json +2305 -0
  45. package/templates/commands/wb_commands_reference.json +1109 -0
  46. package/templates/shortcuts/shortcuts.md +413 -0
  47. package/templates/shortcuts/usage-management-examples-shortcuts/budget_controllers_examples.md +96 -0
  48. package/templates/shortcuts/usage-management-examples-shortcuts/ultimate_shortcuts_examples.md +1531 -0
@@ -0,0 +1,546 @@
1
+ # /wbActOn: Execution Template
2
+
3
+
4
+ <!-- HELP_GATE_START -->
5
+ ## Help intercept (handle FIRST โ€” before any other action)
6
+
7
+ **If `$ARGUMENTS` contains `--help`, `-h`, or `--h`** (case-insensitive, anywhere in the args), DO NOT execute the command's normal procedure. Instead:
8
+
9
+ 1. Output the **HELP BLOCK** below verbatim (rendered as markdown).
10
+ 2. Stop. Do not perform any file reads, writes, or other tool calls.
11
+ 3. Do not generate any reports under `.wb/workflows/reports/`.
12
+
13
+ Otherwise, ignore this section and proceed to the rest of the template.
14
+
15
+ ### HELP BLOCK โ€” `/wbActOn`
16
+
17
+ ## One command, three input modes + one flag
18
+
19
+ ```
20
+ /wbActOn <file-path> # action file only
21
+ /wbActOn <file-path> --wbPlan # action file + sibling plan file
22
+ /wbActOn <folder-path> [--wbPlan] # list recent reports, ask which (skip if one)
23
+ ```
24
+
25
+ The mode is **detected from the input type**:
26
+
27
+ | Input | Mode | Output path |
28
+ |---|---|---|
29
+ | File under `.wb/workflows/reports/` | **Mirror** | `<target>/.wb/workflows/reports/<date>/actions/action_<name>_<date>.md` (Entry #N) |
30
+ | File anywhere else | **Side-car** | Anchored at monorepo root: `frontEnd/wbc-ui/core2/.wb/workflows/reports/<date>/actions/action_<name>_<date>.md` (Entry #N) |
31
+ | Folder | **Pick-then-process** | Lists `*.md` under `<folder>/.wb/workflows/reports/`, asks which |
32
+
33
+ **With `--wbPlan`:** also appends a plan entry to `plans/plan_<target>_<date>.md` โ€” one file per day per scope (no extra suffixes), with N sections (one per ๐Ÿ”ต finding), worker/validator model pairs per task. If the plan file already exists, append as Entry #N.
34
+
35
+ **Outputs never go to `docs/ai_reference/`** โ€” that folder is canon-only. The reference walkthrough at `start_here/from_audit_to_action_wb-core_walkthrough.md` is a hand-curated example, not a runtime output location.
36
+
37
+ **Multi-model:** the same source can be processed by N different models โ€” each appends a new Entry #N to the same file, tagged `*(ModelName โ€” HH:MM)*`. Diff entries to compare opinions.
38
+
39
+ ## When to run it
40
+
41
+ - **After every `/wbAudit`** โ€” turns 23 findings into a 3-rank execution thread.
42
+ - **After `/wbReview`** โ€” triages review comments into act / push-back / defer.
43
+ - **After `/wbPlan`** โ€” re-ranks plan steps by your actual constraints.
44
+ - **On any third-party doc** โ€” competitor analysis, security report, design memo.
45
+
46
+ Skip it after: `/wbDebug`, `/wbDeploy`, `/wbGit`, `/wbClean`, `/wbRefactor`, `/wbTest`, `/wbContext`. These either *do* the work or describe state โ€” there's nothing to triage.
47
+
48
+ ## What it produces (always the same skeleton)
49
+
50
+ 1. **`# I am <ModelName>...`** opener โ€” the active triage model self-declares.
51
+ 2. **๐Ÿงญ Decision tree** at the top (the 5 colors).
52
+ 3. **๐Ÿšฆ ยง0 โ€” If I Were You** โ€” ranked thread (1๏ธโƒฃ โ†’ N) with justifications, time windows (TODAY / THIS WEEK / THIS MONTH / LATER), "what I would NOT touch", 60-second mental model, ROI estimate, **and a `Recommended Model` column per rank**.
53
+ 4. **Annotated source** โ€” original content unchanged, with `[<ModelName> action]` blockquotes after every paragraph and a `<ModelName> action` column appended to every table. Every callout includes a `Recommended model: <name>` line.
54
+ 5. **Action Tally appendix** โ€” counts per color **+ recommended-model mix**, with the insight ("X of Y findings are not slash-command tasks").
55
+ 6. **"How to use" footer** โ€” the 5-step method for next time.
56
+
57
+ **With `--wbPlan`:** also a sibling plan file with N sections (one per ๐Ÿ”ต finding), each section's task table has a `Worker Model` and `Validator Model` column per row.
58
+
59
+ ## The 5 colors (every callout uses exactly one) + recommended models
60
+
61
+ | Color | Decision | Output includes | Default recommended model |
62
+ |---|---|---|---|
63
+ | ๐ŸŸข | One-sentence work (simple) | Exact one-shot prompt to paste back | Sonnet 4 / Qwen3 Coder |
64
+ | ๐ŸŸข | One-sentence work (subtle logic) | Same | Claude Opus 4 |
65
+ | ๐Ÿ”ด | Console error | `/wbDebug "<exact error>"` | Claude Opus 4 |
66
+ | ๐ŸŸก | File-level mess (sweep) | `/wbClean <pkg>` | Qwen3 Coder / Gemini Flash |
67
+ | ๐ŸŸก | File-level mess (refactor) | `/wbRefactor <file>` with target prompt | Claude Opus 4 |
68
+ | ๐ŸŸฃ | Strategic / business | One-shot prompt to draft the strategy memo | Claude Opus 4 / Gemini 3.1 Pro |
69
+ | ๐Ÿ”ต | Multi-step coordinated (decomposition) | `/wbPlan` invocation with goal / constraints / out-of-scope | Claude Opus 4 |
70
+ | ๐Ÿ”ต | Multi-step coordinated (per-task execution) | Per-task entries in the plan file | varies โ€” assigned per task |
71
+
72
+ The recommended model is **advisory** โ€” the user can override. But always state one explicitly; never leave it as "you decide."
73
+
74
+ ## The 5 prioritization rules (applied in this fixed order)
75
+
76
+ 1. **Stop the bleeding first** โ€” consumer-facing breakage and high CVEs outrank everything.
77
+ 2. **Cheap before expensive** โ€” a 30-min ๐Ÿ”ด fix outranks a 1-day ๐ŸŸก refactor.
78
+ 3. **Unblockers next** โ€” fix the test runner before any refactor.
79
+ 4. **Strategy in parallel, not serial** โ€” strategic memos run in their own lane; they don't block code work.
80
+ 5. **Defer the deferable** โ€” P2 always loses to P0/P1.
81
+
82
+ ## Hard rules
83
+
84
+ - **Never modifies the source.** The annotated copy is the only artifact.
85
+ - **Never invents findings** that aren't in the source. Annotates; doesn't author.
86
+ - **Always includes the exact prompt or command.** A callout that says "you should refactor this" without the command is useless.
87
+ - **Always justifies the rank.** Each numbered rank in ยง0 has a Justification cell.
88
+ - **If the source has no obvious actions** (e.g., a pure context/state report), ยง0 says "No actions โ€” this is a state snapshot." Doesn't manufacture work.
89
+
90
+ ## Flag matrix on upstream commands (`--act` and `--wbPlan`)
91
+
92
+ The `/wbActOn` engine is also exposed via flags on a small set of upstream commands. The flags are **independent and composable**:
93
+
94
+ | Command | (no flag) | `--act` | `--wbPlan` | `--act --wbPlan` |
95
+ |---|---|---|---|---|
96
+ | `/wbAudit <pkg>` | audit only | audit + action file | audit + plan file | audit + action + plan (chain of three) |
97
+ | `/wbReview <pkg>` | review only | review + action file | review + plan file | review + action + plan |
98
+ | `/wbStandup <pkg>` | standup only | standup + action file | standup + plan file | standup + action + plan |
99
+ | `/wbPlan <pkg>` | plan only | re-ranked plan | **error: no-op** | **error: no-op** |
100
+
101
+ Why both flags and not collapsed:
102
+
103
+ - `--act` alone is the cheap path โ€” triage without committing to a multi-section plan file.
104
+ - `--wbPlan` alone is the direct path โ€” skip triage when you already know what's worth planning.
105
+ - `--act --wbPlan` together is the obvious chain (triage *then* plan the ๐Ÿ”ตs).
106
+
107
+ Other `/wb*` commands don't take these flags because they either *do* the work directly (`/wbDebug`, `/wbDeploy`, `/wbRefactor`, `/wbTest`, `/wbClean`, `/wbGit`) or describe state without producing actionable findings (`/wbContext`, `/wbSetup`, `/wbVision`). For those, run `/wbActOn` standalone if needed.
108
+
109
+ ## When `/wbActOn` is the wrong command
110
+
111
+ - The source has zero structure (free-form notes, untitled markdown) โ†’ fix the source first; `/wbActOn` needs sections, tables, or numbered items to triage.
112
+ - You want to *generate* a new audit/plan/review โ†’ use the upstream `/wb*` command. `/wbActOn` is the post-processor.
113
+ - You want to *execute* the actions, not just rank them โ†’ run the prompts/commands `/wbActOn` produced. The triage doesn't replace the work.
114
+
115
+ ## The one mistake to avoid
116
+
117
+ **Acting on every callout.** The whole point of ยง0 is that **you stop at the first ๐Ÿ”ด / TODAY rank** and ship that before opening anything below. The tally exists to prove the surface is bigger than the work โ€” believe it.
118
+
119
+ ## Reference example
120
+
121
+ The canonical, working output is:
122
+ [from_audit_to_action_wb-core_walkthrough.md](../../../start_here/from_audit_to_action_wb-core_walkthrough.md)
123
+
124
+ Built from `/wbAudit packages/wb-core/` on 2026-04-26. Every future `/wbActOn` run matches its structure, density, and tone exactly.
125
+
126
+ > For deeper reading: [`docs_claude/commands/wbActOn/wbActOn_practical_claude.md`](../../docs/docs_claude/commands/wbActOn/wbActOn_practical_claude.md) (or the `_eli5_`, `_expert_`, `_examples_` siblings).
127
+
128
+ <!-- FLAGS_TABLE_START -->
129
+ ## Flags & shortcuts
130
+
131
+ Both forms are equivalent โ€” pass either:
132
+
133
+ | Long form | Shortcut |
134
+ |---|---|
135
+ | `--act` | `-a` |
136
+ | `--wbPlan` | `-P` |
137
+
138
+ `-h` / `--help` / `--h` (any command) prints this help block instead of executing.
139
+ ## Self-correct mode (dual-mode invocation)
140
+
141
+ ```
142
+ /wbActOn <scope_folder> # normal mode โ€” produce a fresh output file
143
+ /wbActOn <previous_output_file> # self-correct mode โ€” verify & repair the file in place
144
+ ```
145
+
146
+ When the first arg is an existing output file from a prior `/wbActOn` run (detected by its first H1 โ€” see this template's **Detection** section), the command runs in **verify-and-repair** mode: gap-fills missing fields, normalizes links, ticks done/valid checkboxes whose reports exist, never rewrites authored content. See [`../_shared/output_conventions.md`](../_shared/output_conventions.md) ยง3.
147
+
148
+ <!-- FLAGS_TABLE_END -->
149
+ <!-- HELP_GATE_END -->
150
+
151
+ <!-- FLAG_NORMALIZE_START -->
152
+ ## Flag normalization (apply BEFORE parsing args)
153
+
154
+ Before processing `$ARGUMENTS`, normalize these short-form flags to their long equivalents:
155
+
156
+ - `-a` โ†’ `--act`
157
+ - `-P` โ†’ `--wbPlan`
158
+
159
+ The rest of this template documents only the long forms; the substitution above is the only place short forms are mentioned.
160
+ <!-- FLAG_NORMALIZE_END -->
161
+
162
+
163
+
164
+ **ROLE:** The Triage Officer
165
+ **TARGET:** Any markdown file (typically a `/wb*` report โ€” audit, plan, review, standup, context โ€” but works on any structured document, including third-party reports, design docs, competitor analyses).
166
+ **Read first:** [`../_shared/output_conventions.md`](../_shared/output_conventions.md) โ€” applies to the action and plan files this command produces (relative links, full-syntax commands, self-correct mode, **ยง9 Action Type Tagging** โ€” preserve / propagate the `Requires` column when re-ranking; if the source file pre-dates v1.8 or has the older `๐Ÿ”— Type` column with per-row links, normalize to the plain-text `Requires` column with a single `## ๐Ÿ”— Action Types` legend).
167
+
168
+ ---
169
+
170
+ ## โ”โ”โ” DETECTION (Self-Correct Mode) โ”โ”โ”
171
+
172
+ Trigger self-correct when the input file's first H1 matches:
173
+ `# I am <ModelName>. If I Were At Your Place โ€” Action Walkthrough for <scope>` (action file)
174
+ or `# Plan โ€” <scope> (recommended by <ModelName>)` (companion plan from `--wbPlan`).
175
+
176
+ Behavior is defined in [`../_shared/output_conventions.md`](../_shared/output_conventions.md) ยง3.
177
+
178
+ ActOn-specific gap-fills:
179
+
180
+ - Bare `/wbX` in callouts โ†’ full-syntax `/wbX <target>` per ยง2.
181
+ - Plain-text source/target file references โ†’ relative markdown links per ยง1.
182
+ - Missing `Recommended model` line on a callout โ†’ fill from the per-action recommendation table in Phase 2.
183
+
184
+ ---
185
+
186
+ ## โ”โ”โ” OBJECTIVE โ”โ”โ”
187
+
188
+ Turn a **diagnostic document** into an **execution order**.
189
+
190
+ Apply a 5-color decision tree to every section / paragraph / table-row of the input. Output an annotated copy that opens with a single ranked execution thread (`ยง0 โ€” If I Were You`) and continues with per-section `[<Model> action]` callouts containing exact prompts/commands the user can copy-paste.
191
+
192
+ This is the "from theory to practice" bridge for any document the user reads.
193
+
194
+ **Multi-model design:** The active model self-declares its identity (per `feedback_model_selection`) and every callout label uses that identity. Multiple models running `/wbActOn` on the same source on the same day append their entries to the same universal daily file โ€” tagged with `*(ModelName โ€” HH:MM)*`. Diff the entries to compare opinions.
195
+
196
+ **`--wbPlan` flag:** When passed, also produces a sibling plan file containing one task table per ๐Ÿ”ต finding from the action file. The plan file's task table has a `Recommended Model` column per row (independent of the planner's identity).
197
+
198
+ ---
199
+
200
+ ## โ”โ”โ” THE DECISION TREE (canonical) โ”โ”โ”
201
+
202
+ For every finding, idea, paragraph, or table row, ask in this order:
203
+
204
+ ```
205
+ Is the console red? (any error message, failing build, broken state)
206
+ โ”œโ”€โ”€ Yes โ†’ ๐Ÿ”ด /wbDebug "<exact error message>"
207
+ โ””โ”€โ”€ No โ†’ Continue
208
+
209
+ Is the work small enough to describe in one sentence?
210
+ โ”œโ”€โ”€ Yes โ†’ ๐ŸŸข Inline. Provide the exact one-shot prompt. Skip /wbPlan.
211
+ โ””โ”€โ”€ No โ†’ Continue
212
+
213
+ Did the source flag messiness in a specific file? (>1000 LOC, dead code, monolith)
214
+ โ”œโ”€โ”€ Yes โ†’ ๐ŸŸก /wbClean <package> THEN /wbRefactor <that file> (provide both commands)
215
+ โ””โ”€โ”€ No โ†’ Continue
216
+
217
+ Is this a strategic / commercial / positioning / business-model decision?
218
+ โ”œโ”€โ”€ Yes โ†’ ๐ŸŸฃ No slash command. Open a doc; user decides; Claude advises.
219
+ โ””โ”€โ”€ No โ†’ ๐Ÿ”ต /wbPlan <target> (multi-step, multi-file, coordinated work)
220
+ ```
221
+
222
+ **Color legend** (used throughout the output):
223
+ - ๐ŸŸข **Inline / one-sentence** โ€” describe + exact prompt
224
+ - ๐Ÿ”ด **/wbDebug** โ€” console error
225
+ - ๐ŸŸก **/wbClean + /wbRefactor** โ€” file-level mess
226
+ - ๐ŸŸฃ **Strategic** โ€” human decision, no command
227
+ - ๐Ÿ”ต **/wbPlan** โ€” multi-step coordinated work
228
+
229
+ ---
230
+
231
+ ## โ”โ”โ” PHASE 1: INGEST โ”โ”โ”
232
+
233
+ 1. **Read the input file end-to-end.** Do not skim.
234
+ 2. **Identify document type** from filename + headers. Common types and their cues:
235
+ - `audit_*` / `audit-*` / "Technical Audit" โ†’ audit
236
+ - `plan_*` / "Plan" / numbered task table โ†’ plan
237
+ - `review_*` / "Review" / "PR Review" โ†’ review
238
+ - `standup_*` / "Daily Standup" โ†’ standup
239
+ - `context_*` / "Context Report" โ†’ context
240
+ - Anything else โ†’ "other" (third-party report, design doc, competitor analysis, etc.)
241
+ 3. **Inventory the structure.** Note:
242
+ - Tables (will need a `Claude action` column appended)
243
+ - Enumerated lists / numbered items (will need per-item rank)
244
+ - Prose paragraphs (will need a trailing `[Claude action]` callout)
245
+ 4. **Temporal-memory pass.** Scan `<target_folder>/.wb/workflows/reports/` for prior `actions/` outputs on the same source โ€” if one exists, reference it and only re-rank if the source has changed.
246
+
247
+ ---
248
+
249
+ ## โ”โ”โ” PHASE 2: DECIDE โ”โ”โ”
250
+
251
+ For every finding, walk the decision tree above. For each callout:
252
+
253
+ - ๐Ÿ”ด โ†’ quote the **exact error message** that triggered it
254
+ - ๐ŸŸข โ†’ write the **exact one-shot prompt** the user would paste back to the recommended model
255
+ - ๐ŸŸก โ†’ write **both commands**: `/wbClean <pkg>` and `/wbRefactor <file>` with target prompt
256
+ - ๐ŸŸฃ โ†’ write the **decision question** + a one-shot prompt to draft the strategy memo
257
+ - ๐Ÿ”ต โ†’ write the **`/wbPlan` invocation** with goal, constraints, out-of-scope
258
+
259
+ **Add a `<Model> action` column** to every table in the source (where `<Model>` is the active triage model โ€” e.g., `Claude action`, `Gemini action`). One row of action per row of input.
260
+
261
+ **Wrap each prose paragraph** with a `> [<Model> action โ€” <where>]:` blockquote. Use the section anchor as `<where>` (e.g., `ยง4.1`, `ยง7 #3`).
262
+
263
+ **Per-action model recommendation (mandatory).** Every callout โ€” table row or blockquote โ€” must include a `recommended model` field. The model is picked by task complexity:
264
+
265
+ | Task type | Recommended model | Why |
266
+ |---|---|---|
267
+ | ๐ŸŸข One-shot inline (deterministic, narrow) | **Sonnet 4** or **Qwen3 Coder** | Fast, cheap, enough capability |
268
+ | ๐ŸŸข One-shot inline (touches subtle logic) | **Claude Opus 4** | Pays off for correctness on tricky one-liners |
269
+ | ๐Ÿ”ด /wbDebug | **Claude Opus 4** | Root-cause analysis benefits from reasoning |
270
+ | ๐ŸŸก /wbClean (sweep) | **Qwen3 Coder** or **Gemini Flash** | Repetitive, high-throughput |
271
+ | ๐ŸŸก /wbRefactor (file-level) | **Claude Opus 4** | Cross-file judgment, behavior preservation |
272
+ | ๐ŸŸฃ Strategic memo | **Claude Opus 4** or **Gemini 3.1 Pro** | Long-form synthesis |
273
+ | ๐Ÿ”ต /wbPlan (task decomposition) | **Claude Opus 4** | Coordination + dependency reasoning |
274
+ | ๐Ÿ”ต /wbPlan (per-task execution) | varies โ€” assign per task in the plan | See ยง"--wbPlan flag" below |
275
+
276
+ The recommendation is advisory; the user can override. But always state one explicitly โ€” never leave it as "you decide."
277
+
278
+ ---
279
+
280
+ ## โ”โ”โ” PHASE 3: RANK (the "If I Were You" thread) โ”โ”โ”
281
+
282
+ Build a new top-of-file section called **`ยง0 โ€” If I Were You: The Execution Order`** containing all actions ranked **1๏ธโƒฃ โ†’ N**.
283
+
284
+ **Apply these prioritization rules in this fixed order:**
285
+
286
+ 1. **Stop the bleeding first.** Anything that breaks current consumers (publish bugs, high CVEs, broken main branch) outranks anything that's "merely ugly."
287
+ 2. **Cheap before expensive.** A 30-min fix on a ๐Ÿ”ด outranks a 1-day refactor on a ๐ŸŸก.
288
+ 3. **Unblockers next.** Fix the test runner / broken build / missing tooling before any refactor โ€” refactoring without trustworthy tests is gambling.
289
+ 4. **Strategy in parallel, not serial.** Strategic memos run in their own lane; they don't block code work.
290
+ 5. **Defer the deferable.** P2 items always lose to P0/P1.
291
+
292
+ **Group ranks into time windows:**
293
+ - **TODAY** (โ‰ค 2 hr total) โ€” bleeding only
294
+ - **THIS WEEK** (parallel lanes โ€” pick one per day) โ€” clear-the-table items
295
+ - **THIS MONTH** (pick **one**, not all) โ€” big-thing work
296
+ - **LATER** (P1/P2 โ€” defer freely) โ€” only if ahead of plan
297
+
298
+ **Always include a `What I would NOT touch` block** listing things the source explicitly said are working and should be left alone. This prevents reactive over-refactoring.
299
+
300
+ **Always include a 60-second mental model** at the bottom of ยง0:
301
+ ```
302
+ Rank 1-N (today) โ†’ STOP THE BLEEDING โ†’ X hours
303
+ Rank N+1-M (this week) โ†’ CLEAR THE TABLE โ†’ Y hours
304
+ Rank M+1-K (this month) โ†’ ONE BIG THING โ†’ pick one
305
+ Rank K+1-end (later) โ†’ ONLY IF AHEAD OF PLAN โ†’ defer freely
306
+ ```
307
+
308
+ **Estimate the ROI** of doing only TODAY's ranks (e.g., "audit score moves from X โ†’ ~Y with Z hours of effort").
309
+
310
+ ---
311
+
312
+ ## โ”โ”โ” PHASE 4: WRITE โ”โ”โ”
313
+
314
+ ### Output paths (v2 โ€” Universal Daily File)
315
+
316
+ The `docs/ai_reference/` folder is **reference-only** โ€” never write outputs there. All `/wbActOn` outputs live in the per-target reports tree.
317
+
318
+ > **No `<model>/` subfolder.** All models contribute to ONE file per type per day.
319
+ > **Create-or-Append:** If the file exists, append your action/plan as the next Entry #N.
320
+
321
+ **Action file (always written):**
322
+ ```
323
+ <target>/.wb/workflows/reports/<YYYY>/<MM>/<DD>/actions/action_<short_name>_<YYYYMMDD>.md
324
+ ```
325
+
326
+ **Plan file (only if `--wbPlan` flag is passed):**
327
+ ```
328
+ <target>/.wb/workflows/reports/<YYYY>/<MM>/<DD>/plans/plan_<target_scope>_<YYYYMMDD>.md
329
+ ```
330
+
331
+ **STRICT NAMING RULE (plan files):** The plan filename MUST be exactly `plan_<folder_scope>_<YYYYMMDD>.md`. Do NOT append issue names, source types, or any other suffixes. ONE plan file per day per scope โ€” append as Entry #N if the file already exists.
332
+
333
+ **Filename rules:**
334
+ - `<short_name>` = source basename minus type prefix and timestamp (e.g., `wb-core`, not `audit_wb-core_202604260500`)
335
+ - `<target_scope>` for plan files = the folder scope only (e.g., `wb-core`), no issue/source qualifiers
336
+ - `<target>` = the original source's package/app folder; for non-`/wb*` sources outside any target, use the monorepo root: `frontEnd/wbc-ui/core2/.wb/workflows/reports/`
337
+ - Model identity is in the **Entry #N header**, not the filename
338
+
339
+ **Example outputs** for `/wbActOn audit_wb-core_20260429.md --wbPlan` run by Claude Opus 4.7:
340
+ ```
341
+ packages/wb-core/.wb/workflows/reports/20260429/actions/action_wb-core_20260429.md โ† Entry #1 by Claude Opus 4.7
342
+ packages/wb-core/.wb/workflows/reports/20260429/plans/plan_wb-core_20260429.md โ† Entry #1 by Claude Opus 4.7
343
+ ```
344
+ If Gemini runs the same command later, it appends Entry #2 to the same files โ€” but with **Smart Merge**:
345
+
346
+ ### Smart Merge Protocol (finding-based commands only)
347
+
348
+ When you are the **second (or Nth) model** appending to an existing action or plan file, you MUST:
349
+
350
+ 1. **READ** the entire existing file before writing.
351
+ 2. **EXTRACT** all ranked findings from the existing ยง0 and action callouts.
352
+ 3. **For each finding you identified**, check if it matches an existing finding:
353
+ - **Match criteria:** โ‰ฅ2 of: same file referenced, same function/method, >70% title token overlap.
354
+ - **MATCH FOUND โ†’** Do NOT create a duplicate. Instead add your ranking/model-recommendation/severity vote to a **Model Votes** detail section and update the **Consensus Table**.
355
+ - **NO MATCH โ†’** Add as a new finding.
356
+ 4. **Build/update the Consensus Table** at the top with columns: `# | Finding | Confidence | Models | Color (consensus) | Recommended Model (consensus)`
357
+ - Confidence: `๐ŸŸข N/N` (all models agree), `๐ŸŸก K/N` (partial).
358
+ - Color: when models disagree on the 5-color category, use the **more actionable** color (๐Ÿ”ด > ๐Ÿ”ต > ๐ŸŸก > ๐ŸŸข > ๐ŸŸฃ).
359
+ 5. **Add a merge log** at the bottom: `> *Merged by <ModelName> โ€” HH:MM โ€” X duplicates enriched, Y new findings added*`
360
+
361
+ > **First model?** Just write normally as Entry #1. No Consensus Table needed โ€” it will be created by the second model.
362
+
363
+ ### Action file structure (mandatory)
364
+
365
+ ```markdown
366
+ # I am <ModelName>. If I Were At Your Place โ€” Action Walkthrough for <Short Name>
367
+
368
+ > **Active triage model:** <ModelName> (self-declared)
369
+ > **Source:** [<basename>](<relative path>) โ€” generated by <command> on <date>
370
+ > **What this is:** <1 sentence>
371
+ > **How to read this file:** Black-text blocks are the source unchanged. Every `> [<ModelName> action]` blockquote is my annotation. Every `Recommended model` field tells you which model fits the task โ€” not necessarily me.
372
+
373
+ ---
374
+
375
+ ## ๐Ÿงญ The Decision Tree
376
+
377
+ <paste the canonical decision tree from this template>
378
+
379
+ ---
380
+
381
+ ## ๐Ÿšฆ ยง0 โ€” If I Were You: The Execution Order
382
+
383
+ <the ranked thread per Phase 3 โ€” every numbered rank includes a "Recommended model" cell>
384
+
385
+ ---
386
+
387
+ # <Source title> (annotated)
388
+
389
+ <source content, section by section, with [<ModelName> action] callouts and "<ModelName> action" columns added; every callout has a "Recommended model: ..." line>
390
+
391
+ ---
392
+
393
+ # Appendix: Action Tally
394
+
395
+ | Decision | Count | Examples | Recommended model mix |
396
+ |---|---|---|---|
397
+ | ๐ŸŸข Inline | N | <2-3 examples> | <e.g., 5ร— Sonnet 4, 3ร— Opus 4> |
398
+ | ๐Ÿ”ด /wbDebug | N | ... | <e.g., 1ร— Opus 4> |
399
+ | ๐ŸŸก /wbClean + /wbRefactor | N | ... | <e.g., 2ร— Opus 4 (refactor) + 1ร— Qwen3 (clean)> |
400
+ | ๐ŸŸฃ Strategic | N | ... | <e.g., 9ร— Opus 4> |
401
+ | ๐Ÿ”ต /wbPlan | N | ... | <e.g., 3ร— Opus 4 (planner) + per-task mix> |
402
+
403
+ > **Reading the tally:** State whether the source's surface is bigger than the actual work. (Often it is.)
404
+
405
+ ---
406
+
407
+ ## How to use this walkthrough
408
+
409
+ 1. After every <command>, the action file lives next to the source under `actions/`.
410
+ 2. Walk through it section by section, applying the ๐Ÿงญ decision tree as a sanity check.
411
+ 3. Tally the actions. If the tally has >5 ๐Ÿ”ต /wbPlan items, the source is over-scoped โ€” re-rank by P0/P1/P2 and defer.
412
+ 4. Execute in order: ๐ŸŸข inline first โ†’ ๐Ÿ”ด debug second โ†’ ๐ŸŸก clean+refactor third โ†’ ๐Ÿ”ต plan last โ†’ ๐ŸŸฃ strategy in parallel (always). Use the recommended model per task.
413
+ 5. Re-run the source command after each P0 lands. Use the source's scorecard (if any) as your only metric.
414
+ ```
415
+
416
+ ### Plan file structure (only when `--wbPlan` flag is passed)
417
+
418
+ ```markdown
419
+ # Plan โ€” <Short Name> (recommended by <ModelName>)
420
+
421
+ > **Source action file:** [<action_basename>](<relative path>)
422
+ > **Planner identity:** <ModelName>
423
+ > **Scope:** all ๐Ÿ”ต /wbPlan-class findings from the source action file. Inline ๐ŸŸข, debug ๐Ÿ”ด, refactor ๐ŸŸก, and strategic ๐Ÿฃฃ items are not in this plan โ€” they execute outside the planning loop.
424
+
425
+ ---
426
+
427
+ ## Plan Index
428
+
429
+ | # | Requires | ๐Ÿ”ต Source Finding | Source Rank in ยง0 | Recommended Model | Estimated Effort |
430
+ |---|---|---|---|---|---|
431
+ | 1 | ๐Ÿง  Planner | <finding name> | <rank N> | <model> | <hours/days> |
432
+ | 2 | ๐Ÿ”จ Worker | ... | ... | ... | ... |
433
+
434
+ > **`Requires` column** (mandatory per `_shared/output_conventions.md` ยง9.3): plain-text action-type tag (`๐Ÿง  Planner` / `โœ… Validator` / `๐Ÿ”จ Worker` / `๐Ÿ“‹ Mechanical`). Default for ๐Ÿ”ต /wbPlan-class items is `๐Ÿง  Planner` since they trigger sub-planning; non-planning rows take the tag of the actual sub-task. The file MUST also include a `## ๐Ÿ”— Action Types` legend before the Generated Files footer.
435
+
436
+ ---
437
+
438
+ ## Plan ยง1 โ€” <Finding 1 name>
439
+
440
+ **From source rank:** <N> ยท **Recommended model:** <model> ยท **Estimated effort:** <X>
441
+
442
+ | Task # | Task | Worker Model | Validator Model | โ˜ Done | โ˜ Valid |
443
+ |---|---|---|---|---|---|
444
+ | 1 | <atomic step 1> | <model> | <model> | โฌœ | โฌœ |
445
+ | 2 | <atomic step 2> | <model> | <model> | โฌœ | โฌœ |
446
+ | 3 | <atomic step 3> | <model> | <model> | โฌœ | โฌœ |
447
+
448
+ **Goal:** <1-sentence>
449
+ **Constraints:** <bullet list>
450
+ **Out of scope:** <bullet list>
451
+
452
+ ---
453
+
454
+ ## Plan ยง2 โ€” <Finding 2 name>
455
+
456
+ <same structure>
457
+
458
+ ---
459
+
460
+ ## How to execute
461
+
462
+ 1. Each plan ยงN is independent โ€” run them in priority order from the source action file's ยง0.
463
+ 2. Worker model writes; Validator model checks (different model = independent perspective).
464
+ 3. Mark โ˜ Done when worker finishes, โ˜ Valid when validator confirms.
465
+ 4. If a plan ยงN reveals subtasks that themselves need planning, run `/wbActOn <this plan> --wbPlan` to recurse.
466
+ ```
467
+
468
+ The plan file mirrors your existing `smartprompt_plan_*` task-table convention (worker/validator pattern from `wb-press2_wbdataviewer2`).
469
+
470
+ ---
471
+
472
+ ## โ”โ”โ” REFERENCE EXAMPLE โ”โ”โ”
473
+
474
+ The canonical, working example is:
475
+ **[from_audit_to_action_wb-core_walkthrough.md](../../0_start_here/from_audit_to_action_wb-core_walkthrough.md)** (kept under `docs/ai_reference/0_start_here/` as a **reference document**, not a runtime output โ€” runtime outputs go under `<target>/.wb/workflows/reports/`)
476
+
477
+ Built from `/wbAudit packages/wb-core/` output on 2026-04-26 by Claude Opus 4.7. Match its **structure, tone, and density of action callouts** exactly. Notable patterns to replicate:
478
+ - Per-section blockquote callouts (every prose section gets one)
479
+ - `<Model> action` column appended to every table โ€” column header uses the active triage model's name
480
+ - Every callout (table row or blockquote) includes a **`Recommended model: <name>`** line
481
+ - Strategic findings get `๐ŸŸฃ No command โ€” <Model> advises` with a one-shot prompt to draft the memo
482
+ - Every ๐ŸŸข inline item includes a **complete, copy-pasteable prompt**
483
+ - Every ๐ŸŸก item includes **both commands** (`/wbClean` + `/wbRefactor`) with the refactor target's exact prompt
484
+ - Every ๐Ÿ”ต item includes a **`/wbPlan` invocation** with goal/constraints/out-of-scope
485
+ - ยง0 always cross-links each rank to its source finding (e.g., "ยง4.1, ยง7 #3")
486
+ - ยง0 includes a `Recommended Model` column for every numbered rank
487
+
488
+ ---
489
+
490
+ ## โ”โ”โ” HARD RULES โ”โ”โ”
491
+
492
+ 1. **Never invent findings** that aren't in the source. Annotate; don't author.
493
+ 2. **Always include the exact prompt or command** โ€” a callout that says "you should refactor this" without the command is useless.
494
+ 3. **Always justify the rank.** Each numbered rank in ยง0 has a Justification cell explaining *why* that order.
495
+ 4. **Always preserve source headings and section numbers** so the user can cross-reference.
496
+ 5. **Never modify the source file.** Always write to the output path; the source is read-only.
497
+ 6. **If the source has no obvious actions** (e.g., a pure context/state report), produce a ยง0 that says "No actions โ€” this is a state snapshot. Use it as input to a future command, not as a task list." Don't manufacture work.
498
+ 7. **Respect feedback_no_git** โ€” never embed git commands in any callout. For commit-related callouts, point to `/wbGit` (which produces commit-message text only).
499
+ 8. **Respect feedback_model_selection** โ€” see the per-action recommendation table in Phase 2; always state a model explicitly.
500
+ 9. **Outputs go to `.wb/workflows/reports/`, never to `docs/ai_reference/`.** The reference folder is for canonical examples only.
501
+ 10. **Self-declare model identity at the top of every output.** First line of the file is `# I am <ModelName>. ...` โ€” this is the contract that lets parallel-model runs coexist in the same folder.
502
+
503
+ ---
504
+
505
+ ## โ”โ”โ” INVOCATION โ”โ”โ”
506
+
507
+ ```
508
+ /wbActOn <file-or-folder-path> # action file only
509
+ /wbActOn <file-or-folder-path> --wbPlan # action file + sibling plan file
510
+ ```
511
+
512
+ **Inputs:**
513
+ - If a **file** is given โ†’ process it directly.
514
+ - If a **folder** is given โ†’ list the most recent `*.md` files under `<folder>/.wb/workflows/reports/` and ask which to act on. If only one candidate exists, proceed without asking.
515
+
516
+ **End every action file with:**
517
+
518
+ ## ๐Ÿงญ What's Next?
519
+
520
+ Run `/wbNext <target_folder>` for a current, ranked list of next actions across all reports โ€” `/wbActOn` ranks within one source, `/wbNext` ranks across them.
521
+
522
+ **Flags:**
523
+ - `--wbPlan` โ€” also produce a plan entry (one task table per ๐Ÿ”ต finding from the action file). Same universal daily file convention with `plan_` prefix, lives under `plans/` instead of `actions/`.
524
+
525
+ **Multi-model runs:** the same source can be processed by multiple models โ€” each appends an entry to the same file, tagged with `*(ModelName โ€” HH:MM)*`. Diff the entries to compare opinions.
526
+
527
+ The user supplies the source; this command supplies the execution order โ€” and optionally the plan to execute it.
528
+
529
+ ---
530
+
531
+ ## โ”โ”โ” EXTENSION TO OTHER COMMANDS (`--act` and `--wbPlan`) โ”โ”โ”
532
+
533
+ The `/wbActOn` engine is also exposed via flags on a small set of upstream commands. The flags are **independent and composable**:
534
+
535
+ | Command | Flag | Behavior |
536
+ |---|---|---|
537
+ | `/wbAudit <target>` | (no flag) | Just the audit |
538
+ | `/wbAudit <target> --act` | | Audit + sibling action file (calls `/wbActOn` engine internally) |
539
+ | `/wbAudit <target> --wbPlan` | | Audit + sibling plan file (no intermediate action file) |
540
+ | `/wbAudit <target> --act --wbPlan` | | Audit + action file + plan file (chain of three) |
541
+ | `/wbReview` | same matrix | |
542
+ | `/wbStandup` | same matrix | |
543
+ | `/wbPlan <target> --act` | | Re-ranked version of the input plan |
544
+ | `/wbPlan <target> --wbPlan` | | **Error: no-op** โ€” the output is already a plan; use `--act` alone |
545
+
546
+ The flag matrix is intentionally limited to these 4 commands. Other `/wb*` commands either *do* the work directly (e.g., `/wbDebug`, `/wbDeploy`, `/wbRefactor`, `/wbTest`, `/wbClean`, `/wbGit`) or describe state without producing actionable findings (`/wbContext`, `/wbSetup`, `/wbVision`). For those, run `/wbActOn` standalone if needed.