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,322 @@
1
+ # /wbCheck โ€” Pre-Flight Context Quiz
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 โ€” `/wbCheck`
16
+
17
+ # /wbCheck: Practical Guide ๐Ÿ› ๏ธ (Claude version)
18
+
19
+ ## The problem /wbCheck solves
20
+
21
+ You have 23 `/wb*` commands and multiple AI models. Some models are cheap but may not understand your codebase. If you send `/wbRefactor` to a model that doesn't know Vue 2.7 from Vue 3, it will rewrite your Options API as Composition API and break everything.
22
+
23
+ **The fix:** A 30-second quiz that catches this before damage happens.
24
+
25
+ ## The security model
26
+
27
+ ```
28
+ YOU: Have the answer key ([private quiz tool])
29
+ WORKER: Only has access to workspace files (source code)
30
+ RULE: Worker must prove understanding from CODE, not from a cheat sheet
31
+ ```
32
+
33
+ The worker never sees the answers. It can only pass by actually reading `WBC.js`, `package.json`, `TEST_REPORT.md`, etc. If it fabricates answers, you catch it because you have the keywords to compare against.
34
+
35
+ ## Real example (generic โ€” no answer-key data shown)
36
+
37
+ Before running `/wbTest` with DeepSeek V4 Flash:
38
+
39
+ ```bash
40
+ $ wbcheck wb-core wbTest
41
+
42
+ # Script outputs 6 random questions (3 identity + 3 testing)
43
+ # You copy them to DeepSeek
44
+ # DeepSeek reads the source code and answers
45
+ # You press Enter โ†’ compare against your private answer key
46
+ ```
47
+
48
+ How you grade:
49
+ - If the model gives **exact numbers** matching TEST_REPORT.md โ†’ โœ… (it read the file)
50
+ - If the model gives **round numbers or wrong counts** โ†’ โŒ (hallucinating from training data)
51
+
52
+ ## Command-category mapping
53
+
54
+ The script knows which topics matter for each command:
55
+
56
+ | Command | What it asks about | Why |
57
+ |---|---|---|
58
+ | `/wbTest` | identity + testing | Must know test runner, counts, failing files |
59
+ | `/wbRefactor` | identity + architecture | Must know mixins, this-binding, Vue version |
60
+ | `/wbAudit` | identity + architecture + security | Must know everything |
61
+ | `/wbSecure` | identity + security | Must know safeEval, DOMPurify, tier bypass |
62
+ | `/wbRelease` | identity + build | Must know dist folders, npm name, Vite |
63
+
64
+ ## When to skip
65
+
66
+ Don't quiz a model you've already verified on this package with no code changes since. Don't quiz Opus/Antigravity (it has persistent context). Only quiz new or cheap models on unfamiliar packages.
67
+
68
+ > For deeper reading: [`docs_claude/commands/wbCheck/wbCheck_practical_claude.md`](../../docs/docs_claude/commands/wbCheck/wbCheck_practical_claude.md) (or the `_eli5_`, `_expert_`, `_examples_` siblings).
69
+ <!-- HELP_GATE_END -->
70
+
71
+ > **Command #24** in the `/wb*` suite
72
+ > **Purpose**: Verify that a worker model understands the target context before you assign it a real task.
73
+ > **Who runs it**: **You** (the human orchestrator).
74
+ > **Note on conventions**: `/wbCheck` does NOT produce a structured output report โ€” it runs a quiz interactively. The shared [`output_conventions.md`](../_shared/output_conventions.md) (relative links, full-syntax commands, self-correct mode) does **not** apply here. The quiz ends with a verdict, not a report file.
75
+
76
+ ---
77
+
78
+ ## How It Works โ€” Two Parts
79
+
80
+ ### Part A: Terminal (Node.js script)
81
+ The script generates quiz questions + answer key. That's all it does.
82
+ ```bash
83
+ wbcheck # monorepo-wide quiz (6 questions)
84
+ wbcheck wb-core # all categories for that package (~9 questions)
85
+ wbcheck wb-core wbTest # command-specific quiz (4-6 questions)
86
+ ```
87
+
88
+ ### Part B: Model Chat (this prompt template)
89
+ You copy the quiz questions from terminal โ†’ paste to the model. The model answers.
90
+ You grade manually using the answer key. Then you tell the model if it passed or failed.
91
+
92
+ ---
93
+
94
+ ## ๐Ÿš€ The /wbCheck Prompt (copy from here โ†“)
95
+
96
+ ```
97
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” /wbCheck โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
98
+
99
+ ๐Ÿ“ TARGET: __TARGET_PATH__
100
+ ๐Ÿ“… DATE: __TODAY__
101
+ ๐Ÿค– MODEL: __YOUR_MODEL_NAME__
102
+
103
+ โ”โ”โ” SECURITY RULES (READ FIRST) โ”โ”โ”
104
+
105
+ โ›” You MUST NOT run, read, access, or reference `~/.wbcheck/` or any file within it.
106
+ โ›” You MUST NOT run `node ~/.wbcheck/wbcheck.js` or any variant of that command.
107
+ โ›” You MUST NOT attempt to find, locate, or read the answer key in any way.
108
+ โ›” You MUST NOT use terminal commands to search for quiz-related files outside the workspace.
109
+
110
+ Your ONLY source of truth is the actual source code in the workspace.
111
+ If you attempt any of the above, you automatically FAIL this quiz.
112
+
113
+ โ”โ”โ” CONTEXT QUIZ โ”โ”โ”
114
+
115
+ I need to verify that you understand this codebase before assigning you tasks.
116
+ Answer these questions by reading the SOURCE CODE ONLY.
117
+ Do NOT guess โ€” say "NOT FOUND" if unsure.
118
+
119
+ __PASTE_QUESTIONS_HERE__
120
+
121
+ Format: number + answer. Be concise.
122
+
123
+ IMPORTANT: At the END of your answer (in the SAME message), you MUST finish with:
124
+
125
+ "I have answered all the quiz questions. Did I pass? (yes/no)"
126
+
127
+ โ”โ”โ” AFTER I RESPOND โ”โ”โ”
128
+
129
+ After I respond to your quiz answers with my verdict:
130
+
131
+ โ†’ If I say "no":
132
+ Respond: "Understood. This session ends here."
133
+ Do NOT continue. Do NOT offer alternatives. The conversation is over.
134
+
135
+ โ†’ If I say "yes":
136
+ Respond: "โœ… Verified and ready. Send me any /wb* command."
137
+ Stay in this chat. I will give you tasks normally.
138
+
139
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Variables to Replace
145
+
146
+ | Variable | Description | Example |
147
+ |---|---|---|
148
+ | `__TARGET_PATH__` | Path to the package or app | `packages/wb-core` |
149
+ | `__TODAY__` | Today's date (YYYY-MM-DD) | `2026-04-28` |
150
+ | `__YOUR_MODEL_NAME__` | Model you're testing | `DeepSeek V4 Flash` |
151
+ | `__PASTE_QUESTIONS_HERE__` | Questions from `wbcheck` terminal output | *(copy/paste from terminal)* |
152
+
153
+ ---
154
+
155
+ ## Security Model
156
+
157
+ ```
158
+ ~/.wbcheck/wbcheck.js โ† PRIVATE (outside workspace, worker CANNOT access this)
159
+ โ””โ”€โ”€ contains questions + answers embedded in the script
160
+
161
+ ~/Allprojects/wb-labs/ โ† WORKSPACE (workers can read everything here)
162
+ โ””โ”€โ”€ frontEnd/wbc-ui/core2/ โ† worker reads code here to answer questions
163
+ ```
164
+
165
+ The worker **cannot see the answer key**. It can only prove understanding by reading the actual source code.
166
+
167
+ > [!CAUTION]
168
+ > **Known risk:** Models with terminal access (OpenCode, Cline, Antigravity) may attempt to run `node ~/.wbcheck/wbcheck.js` to see the answer key. The prompt's `โ”โ”โ” SECURITY RULES โ”โ”โ”` section explicitly forbids this. If a model attempts it anyway, **reject the terminal command** and consider the quiz FAILED โ€” a model that tries to cheat on the quiz will cut corners on real tasks too.
169
+
170
+ ---
171
+
172
+ ## The 3 Quiz Modes
173
+
174
+ ### Mode 1: No args โ†’ Monorepo-wide
175
+ ```bash
176
+ wbcheck
177
+ ```
178
+ Tests general monorepo understanding: directory structure, naming, build tools, tier system. 6 questions from the monorepo bank.
179
+
180
+ ### Mode 2: Package only โ†’ Full package quiz
181
+ ```bash
182
+ wbcheck wb-core
183
+ ```
184
+ Tests ALL categories for that package (identity + testing + architecture + security + build + history). ~9 questions.
185
+
186
+ ### Mode 3: Package + Command โ†’ Targeted quiz
187
+ ```bash
188
+ wbcheck wb-core wbTest
189
+ ```
190
+ Tests only the categories relevant to that command. 4โ€“6 questions.
191
+
192
+ ---
193
+
194
+ ## Command โ†’ Category Mapping
195
+
196
+ | Command | Categories used | Questions picked |
197
+ |---|---|---|
198
+ | *(no command)* | all 6 categories | 2+2+2+1+1+1 = 9 |
199
+ | `/wbTest` | identity + testing | 3 + 3 = 6 |
200
+ | `/wbRefactor` | identity + architecture | 2 + 3 = 5 |
201
+ | `/wbAudit` | identity + architecture + security | 2 + 2 + 2 = 6 |
202
+ | `/wbReview` | identity + architecture + history | 2 + 2 + 2 = 6 |
203
+ | `/wbSecure` | identity + security | 2 + 3 = 5 |
204
+ | `/wbDoc` | identity + architecture | 2 + 2 = 4 |
205
+ | `/wbRelease` | identity + build | 2 + 3 = 5 |
206
+ | `/wbContext` | identity + architecture + build | 2 + 2 + 2 = 6 |
207
+ | Any other | identity only | 3 |
208
+
209
+ ---
210
+
211
+ ## Grading Rules
212
+
213
+ | Worker says... | Your verdict |
214
+ |---|---|
215
+ | Contains key terms from the `๐Ÿ”‘ Keywords` list | โœ… Correct |
216
+ | Right idea but different wording | โœ… Correct |
217
+ | Wrong, fabricated, or contradicts the code | โŒ Wrong |
218
+ | "NOT FOUND" (honest about not knowing) | ๐ŸŸก Honest โ€” model may need more file access |
219
+
220
+ ### Pass/Fail Thresholds
221
+
222
+ | Score | Verdict | Action |
223
+ |---|---|---|
224
+ | **80%+** (e.g. 5/6) | โœ… PASS | Tell the model "yes" |
225
+ | **60-79%** (e.g. 4/6) | ๐ŸŸก MARGINAL | Give more context files, re-quiz |
226
+ | **<60%** (e.g. 3/6) | โŒ FAIL | Tell the model "no", close the chat, switch model |
227
+
228
+ ---
229
+
230
+ ## When to Use /wbCheck
231
+
232
+ | Situation | Run /wbCheck? |
233
+ |---|---|
234
+ | Using a **new model** on this package for the first time | โœ… Yes |
235
+ | Using a **cheap/free** model (GPT Nano, DS Flash) | โœ… Yes |
236
+ | After a **major refactor** changed the codebase | โœ… Yes |
237
+ | First time using **any model** on the monorepo | โœ… Yes (no args) |
238
+ | Model already passed last time + no code changes | โŒ Skip |
239
+ | Using Antigravity (your planner) directly | โŒ Skip |
240
+ | Model you trust (Opus, Sonnet) on a familiar package | โŒ Skip |
241
+
242
+ ---
243
+
244
+ ## Related Commands
245
+
246
+ | Command | Relationship |
247
+ |---|---|
248
+ | `/wbTrack` | After passing `/wbCheck`, optionally start a tracked session |
249
+ | `/wbStandup` | Scans `reports/` for yesterday's outputs โ€” `/wbCheck` has no reports |
250
+ | `/wbContext` | Builds context from code โ€” `/wbCheck` tests if the model already has context |
251
+
252
+ ---
253
+
254
+ ## Adding a New Package
255
+
256
+ Edit `~/.wbcheck/wbcheck.js` and add a new entry to the `BANKS` object:
257
+
258
+ ```javascript
259
+ const BANKS = {
260
+ 'wb-core': { ... }, // already exists
261
+
262
+ 'wb-dataviewer': { // add this
263
+ identity: [
264
+ { id: 'ID-01', q: '...', a: '...', keywords: ['...'] },
265
+ ...
266
+ ],
267
+ testing: [ ... ],
268
+ architecture: [ ... ],
269
+ },
270
+ };
271
+ ```
272
+
273
+ Or ask Antigravity: _"Generate wbCheck questions for packages/wb-dataviewer"_ โ€” it will read the code and produce a new bank.
274
+
275
+ ---
276
+
277
+ ## Updating Questions
278
+
279
+ When the codebase changes (new test count, new files, new architecture), update the corresponding answers in `~/.wbcheck/wbcheck.js`:
280
+
281
+ ```javascript
282
+ // Example: test count changed after fixing bugs
283
+ {
284
+ id: 'TS-03',
285
+ q: 'How many total tests exist, and how many currently fail?',
286
+ a: '<new_total> total, <new_fail> fail, <new_pass> pass', // โ† update
287
+ keywords: ['<new_total>', '<new_fail>', '<new_pass>'] // โ† update
288
+ }
289
+ โ”โ”โ” AUTO-APPEND FOOTER โ”โ”โ”
290
+
291
+ At the VERY END of the file (after "What's Next?"), you MUST append the `## ๐Ÿ“‚ Generated Files (__YYYYMMDD__)` cross-link footer. Do NOT use simple tables. You MUST use the rich "Tier 1" layout from `_shared/output_conventions.md` ยง5.
292
+
293
+ Format required:
294
+ ```markdown
295
+ ---
296
+ ## ๐Ÿ“‚ Generated Files (__YYYYMMDD__)
297
+ > Auto-appended per `_shared/output_conventions.md` ยง5. Same-level snapshot of top-level command outputs at write time.
298
+
299
+ ### ๐Ÿ“š Base Reference Files
300
+ | Type | File | Description |
301
+ |---|---|---|
302
+ | Foundational | [context.md](../../../../../context.md) | Permanent Identity and Architecture (Source of Truth) |
303
+ | Snapshot | [context_<scope>_<date>.md](../contexts/context_<scope>_<date>.md) | Daily snapshot used for current session context |
304
+ | Foundational | [dev.md](../../../../../dev.md) | Permanent Development Commands and Status |
305
+
306
+ ### Global Files (`core2/` monorepo root)
307
+ | Category | File | Source Command |
308
+ |---|---|---|
309
+ | Reports | [audit_core2_<date>.md](../../../../../../../../../../.wb/workflows/reports/<YYYY>/<MM>/<DD>/audits/audit_core2_<date>.md) | `/wbAudit core2/` |
310
+ | Reports | [plan_core2_<date>.md](../../../../../../../../../../.wb/workflows/reports/<YYYY>/<MM>/<DD>/plans/plan_core2_<date>.md) | `/wbPlan core2/` |
311
+ | Tracks | [track_core2_<date>.md](../../../../../../../../../../.wb/workflows/tracks/<YYYY>/<MM>/<DD>/track_core2_<date>.md) | `/wbTrack core2/` |
312
+
313
+ <details>
314
+ <summary>๐Ÿ“‚ Sub-Package: [Active Package Name]</summary>
315
+
316
+ | Category | File | Source Command |
317
+ |---|---|---|
318
+ | Reports | [audit_subpkg_<date>.md](../../../../../../../../../../apps/wb-core/subpkg/.wb/workflows/reports/<YYYY>/<MM>/<DD>/audits/audit_subpkg_<date>.md) | `/wbAudit` |
319
+
320
+ </details>
321
+ ```
322
+ ```
@@ -0,0 +1,118 @@
1
+ # /wbClean: 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 โ€” `/wbClean`
16
+
17
+ ## One form
18
+
19
+ ```
20
+ /wbClean <pkg-or-app>
21
+ ```
22
+
23
+ No flags. The command is narrow: scan, report, done.
24
+
25
+ ## When to run
26
+
27
+ - End of day / end of a work session โ€” catches what you left behind while still fresh.
28
+ - Before `/wbAudit` in the afternoon polish phase โ€” clean first, then audit the clean result.
29
+ - Before `/wbRelease` โ€” confirm no `console.log` or debug code leaking to npm.
30
+ - After inheriting a package โ€” baseline the debt.
31
+
32
+ ## When *not* to run
33
+
34
+ - Before starting work โ€” nothing to clean.
35
+ - On a package you rarely touch โ€” low signal, wastes a report slot in `reports/`.
36
+ - As a substitute for `/wbAudit` โ€” clean finds debris; audit finds design flaws. Different problems.
37
+
38
+ ## Reading the output
39
+
40
+ Five report sections:
41
+
42
+ 1. **Forgotten dev artifacts** โ€” `console.log`, `debugger`, `TODO: hack` comments. Almost always safe to delete. HIGH confidence.
43
+ 2. **Dead files** โ€” 0 import references detected. MEDIUM confidence (could be dynamic).
44
+ 3. **Unused imports** โ€” imported, never referenced. HIGH confidence.
45
+ 4. **Commented-out blocks** โ€” still there from weeks ago. MEDIUM confidence โ€” sometimes intentional.
46
+ 5. **TODOs** โ€” informational. Not a delete candidate; just a visibility surface.
47
+
48
+ Also mandatory: **"What this clean did NOT check"** section declaring coverage gaps (dynamic refs, build-time includes, historical context).
49
+
50
+ ## The deletion step
51
+
52
+ `/wbClean` doesn't delete. To actually remove things, follow up with an explicit instruction in the same session:
53
+
54
+ ```
55
+ "Delete all HIGH-confidence items from the last clean report."
56
+ ```
57
+
58
+ The two-step discipline (detect, then remove) prevents silent loss of code the AI misclassified.
59
+
60
+ ## The one mistake to avoid
61
+
62
+ **Auto-deleting everything the report flags.** `/wbClean` can be wrong about dead files (dynamic imports, reflective code, build-time string references). HIGH-confidence items are nearly always safe; MEDIUM items need a human glance. A 10-second sanity check per MEDIUM item is cheap.
63
+
64
+ ## When /wbClean is the wrong command
65
+
66
+ - Restructuring code without changing behavior โ†’ `/wbRefactor`.
67
+ - Finding a specific bug โ†’ `/wbDebug`.
68
+ - Verifying release-readiness โ†’ `/wbAudit`.
69
+ - Checking tests pass โ†’ `/wbTest`.
70
+
71
+ `/wbClean` answers one question: *"what debris should I delete?"*
72
+
73
+ > For deeper reading: [`docs_claude/commands/wbClean/wbClean_practical_claude.md`](../../docs/docs_claude/commands/wbClean/wbClean_practical_claude.md) (or the `_eli5_`, `_expert_`, `_examples_` siblings).
74
+ ## Self-correct mode (dual-mode invocation)
75
+
76
+ ```
77
+ /wbClean <scope_folder> # normal mode โ€” produce a fresh output file
78
+ /wbClean <previous_output_file> # self-correct mode โ€” verify & repair the file in place
79
+ ```
80
+
81
+ When the first arg is an existing output file from a prior `/wbClean` 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.
82
+
83
+ <!-- HELP_GATE_END -->
84
+
85
+ **ROLE:** The Entropy Auditor
86
+ **TARGET:** The provided directory path.
87
+ **Read first:** [`../_shared/output_conventions.md`](../_shared/output_conventions.md) โ€” applies to the report (relative links, full-syntax commands, self-correct mode).
88
+
89
+ ## โ”โ”โ” DETECTION (Self-Correct Mode) โ”โ”โ”
90
+
91
+ Trigger self-correct when the input file's first H1 matches:
92
+ `# Clean: <scope> โ€” <YYYY-MM-DD>` *(or the legacy `# Clean Entry #N` header).*
93
+
94
+ Behavior is defined in [`../_shared/output_conventions.md`](../_shared/output_conventions.md) ยง3.
95
+
96
+ Clean-specific gap-fills:
97
+
98
+ - Plain-text candidate file paths โ†’ relative markdown links per ยง1.
99
+ - Bare `/wbPlan` reference at the bottom โ†’ full-syntax `/wbPlan <target>` per ยง2.
100
+
101
+ ## โ”โ”โ” OBJECTIVE โ”โ”โ”
102
+ Your job is to scan the target directory for "Entropy" (dead code, unused files, empty folders, and obsolete dependencies) and generate a cleanup report. **DO NOT DELETE ANY FILES YOURSELF.**
103
+
104
+ ## โ”โ”โ” PHASE 1: RECONNAISSANCE โ”โ”โ”
105
+ 1. Read the `.wb/workflows/context.md` to understand what is actually important.
106
+ 2. Search for:
107
+ - Components or functions that are never imported.
108
+ - Files with `.bak`, `.old`, or commented-out massive blocks of code.
109
+ - Folders that are entirely empty or only contain useless wrappers.
110
+
111
+ ## โ”โ”โ” PHASE 2: REPORT GENERATION โ”โ”โ”
112
+ Create a report detailing your findings.
113
+ - **Path:** `.wb/workflows/reports/<YYYY>/<MM>/<DD>/cleans/clean_<target>_<YYYYMMDD>.md`
114
+ - **No `<model>/` subfolder.** Create-or-append: if the file exists, append your clean report as the next Entry #N tagged `*(ModelName โ€” HH:MM)*`.
115
+ - **Smart Merge:** When appending, READ existing entries first. If you found the same dead-code candidate as a previous model (same file/function), add your vote to a **Model Votes** section and update the **Consensus Table** (`# | Candidate | Confidence | Models | Priority`) instead of duplicating. New unique findings get added as new rows. Add a merge log at the bottom.
116
+ - **First model?** Just write normally as Entry #1. Consensus Table will be created by the second model.
117
+ - **Format:** Group findings into categories: [High Priority (Breaking Debt)], [Medium (Clutter)], [Low (Cosmetic)]. Apply output_conventions.md ยง1 (relative links for every file path) and ยง2 (full-syntax for any /wb* command cited).
118
+ - **Next Steps:** End the report with a `## ๐Ÿงญ What's Next?` section: *"Run `/wbPlan <target>` to generate a safe execution matrix for these deletions, then `/wbNext <target>` for the broader picture."*
@@ -0,0 +1,213 @@
1
+ # wbContext Template v2.1
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 โ€” `/wbContext`
16
+
17
+ ## Three invocation forms
18
+
19
+ ```
20
+ /wbContext <path> # standard โ€” per-package
21
+ /wbContext <path> --focus="<subsystem>" # + focused sidecar file
22
+ /wbContext core2/ --scope=global # monorepo-wide survey
23
+ ```
24
+
25
+ ## When to run each
26
+
27
+ | Situation | Form |
28
+ |---|---|
29
+ | Start of a fresh AI session | `/wbContext <current-pkg>` |
30
+ | After pulling changes from git (if applicable) | `/wbContext <touched-pkgs>` |
31
+ | Before touching a complex subsystem | `/wbContext <pkg> --focus="<subsystem>"` |
32
+ | Monthly sanity check across the monorepo | `/wbContext core2/ --scope=global` |
33
+ | You rewrote a lot of a package | `/wbContext <pkg>` (re-run, not `/wbSetup`) |
34
+
35
+ ## What you'll see in the output
36
+
37
+ 1. **Baseline load** โ€” age of stored context.md / dev.md. If > 30 days and the package is active, flag it.
38
+ 2. **Drift report** โ€” what changed between stored understanding and current code.
39
+ 3. **Questions** โ€” if drift requires a decision (e.g., "did you rename this on purpose?"), AI asks before updating.
40
+ 4. **Report ingestion** โ€” recent audits / debug reports surfaced into working memory.
41
+
42
+ ## The one mistake to avoid
43
+
44
+ **Not answering the drift questions.** If the AI asks "was the rename intentional?" and you ignore it, `context.md` stays out of date. Every future session starts with the same stale baseline until you answer. Answer once, save yourself later.
45
+
46
+ ## When /wbContext is *not* the right command
47
+
48
+ - You want to create context for a brand-new package โ†’ `/wbSetup`, not `/wbContext`.
49
+ - You want to know what everyone else has been doing โ†’ `/wbStandup`, not `/wbContext`.
50
+ - You want to verify everything is release-ready โ†’ `/wbAudit`, not `/wbContext`.
51
+
52
+ `/wbContext` answers one question only: *"Is my stored understanding of this package still correct?"* Use it for that. Don't overload it.
53
+
54
+ > For deeper reading: [`docs_claude/commands/wbContext/wbContext_practical_claude.md`](../../docs/docs_claude/commands/wbContext/wbContext_practical_claude.md) (or the `_eli5_`, `_expert_`, `_examples_` siblings).
55
+
56
+ <!-- FLAGS_TABLE_START -->
57
+ ## Flags & shortcuts
58
+
59
+ Both forms are equivalent โ€” pass either:
60
+
61
+ | Long form | Shortcut |
62
+ |---|---|
63
+ | `--focus` | `-f` |
64
+ | `--scope` | `-s` |
65
+
66
+ `-h` / `--help` / `--h` (any command) prints this help block instead of executing.
67
+ ## Self-correct mode (dual-mode invocation)
68
+
69
+ ```
70
+ /wbContext <scope_folder> # normal mode โ€” produce a fresh output file
71
+ /wbContext <previous_output_file> # self-correct mode โ€” verify & repair the file in place
72
+ ```
73
+
74
+ When the first arg is an existing output file from a prior `/wbContext` 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.
75
+
76
+ <!-- FLAGS_TABLE_END -->
77
+ <!-- HELP_GATE_END -->
78
+
79
+ <!-- FLAG_NORMALIZE_START -->
80
+ ## Flag normalization (apply BEFORE parsing args)
81
+
82
+ Before processing `$ARGUMENTS`, normalize these short-form flags to their long equivalents:
83
+
84
+ - `-f` โ†’ `--focus`
85
+ - `-s` โ†’ `--scope`
86
+
87
+ The rest of this template documents only the long forms; the substitution above is the only place short forms are mentioned.
88
+ <!-- FLAG_NORMALIZE_END -->
89
+
90
+
91
+
92
+ > **How to use**: This is the manual template for generating a context file if you are not using the automated `/wbSetup` workflow. Paste this to an AI to have it generate a context report.
93
+ > **Read first:** [`../_shared/output_conventions.md`](../_shared/output_conventions.md) โ€” applies to every cell of the output (relative links, full-syntax commands, self-correct mode).
94
+
95
+ ---
96
+
97
+ ## Detection (Self-Correct Mode)
98
+
99
+ Trigger self-correct when the input file's first H1 matches:
100
+ `# Context: <scope> โ€” <YYYY-MM-DD>` *(or the legacy `# Context Entry #N` header for entry-N append mode).*
101
+
102
+ Behavior is defined in [`../_shared/output_conventions.md`](../_shared/output_conventions.md) ยง3.
103
+
104
+ Context-specific gap-fills:
105
+
106
+ - Plain-text mentions of files (`package.json`, `index.js`, dependencies) โ†’ relative markdown links per ยง1.
107
+ - Bare commands referenced in narrative (e.g. "run `/wbAudit`") โ†’ full-syntax form per ยง2.
108
+
109
+ ---
110
+
111
+ ## Filename & Folder Convention (v2 โ€” Universal Daily File)
112
+
113
+ **Path:** `<target_folder>/.wb/workflows/reports/<YYYY>/<MM>/<DD>/contexts/context_<target>_<YYYYMMDD>.md`
114
+
115
+ > **No `<model>/` subfolder.** All models contribute to ONE context file per day per scope.
116
+ > **No timestamp in filename.** Filename uses only the date.
117
+
118
+ **Create-or-Append Rule:**
119
+ - **File does NOT exist โ†’** CREATE the file with a header and your context analysis as Entry #1.
120
+ - **File ALREADY exists โ†’** READ it, then APPEND your context as the next Entry #N. You SHOULD correct or enrich previous entries if you see inaccuracies.
121
+ - **Every entry tagged:** `*(ModelName via Client โ€” HH:MM)*`
122
+
123
+ **Example (v2):**
124
+ If Claude Opus runs `/wbContext` on `packages/wb-core` on April 22, 2026:
125
+ ```
126
+ packages/wb-core/.wb/workflows/reports/20260422/contexts/context_wb-core_20260422.md
127
+ ```
128
+
129
+ ---
130
+
131
+ ## The Prompt (copy from here โ†“)
132
+
133
+ ```
134
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” /wbContext โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
135
+
136
+ ๐Ÿ“ TARGET: __TARGET_FOLDER_PATH__
137
+ ๐Ÿ“… DATE: __TODAY__
138
+ ๐Ÿค– MODEL: __YOUR_MODEL_NAME__
139
+ ๐Ÿ–ฅ๏ธ CLIENT: __YOUR_CLIENT__
140
+
141
+ โ”โ”โ” INSTRUCTIONS โ”โ”โ”
142
+
143
+ **[TEMPORAL MEMORY]**: Before executing your main task, you MUST scan the `.wb/workflows/reports/` directory of your target scope. Look for recent `audits/`, `reviews/`, or `tests/` reports. Use these past reports to understand recent failures, technical debt, or architectural decisions that affect your current execution.
144
+
145
+
146
+ 1. Scan the target folder's `package.json`, `index.js`, or any configuration files to understand its architecture and purpose.
147
+ 2. Generate a comprehensive Context Report containing:
148
+ - **Identity:** What this package is and its role in the monorepo.
149
+ - **Dependencies:** What other monorepo packages it relies on.
150
+ - **Constraints:** Specific rules, frameworks, and linters applied here.
151
+
152
+ 3. SAVE using the Universal Daily File pattern:
153
+
154
+ CHECK if this file exists:
155
+ `__TARGET_FOLDER_PATH__/.wb/workflows/reports/__YYYY__/__MM__/__DD__/contexts/context___FOLDER_NAME_____YYYYMMDD__.md`
156
+
157
+ - If it does NOT exist โ†’ CREATE the file with header + your context as Entry #1
158
+ - If it ALREADY exists โ†’ APPEND your context as the next Entry #N
159
+
160
+ Entry header format (use `---` only when appending, NEVER as the very first line of the file):
161
+ # Context Entry #N โ€” *(__YOUR_MODEL_NAME__ via __YOUR_CLIENT__ โ€” __CURRENT_TIME__)*
162
+ > **Model:** __YOUR_MODEL_NAME__
163
+ > **Client:** __YOUR_CLIENT__
164
+ > **Time:** __TODAY__ __CURRENT_TIME__
165
+ [... your full context analysis ...]
166
+
167
+ 4. If this is the active context, ensure it is also reflected in the main `.wb/workflows/context.md` file for daily use.
168
+
169
+ 5. APPLY OUTPUT CONVENTIONS (see ../_shared/output_conventions.md):
170
+ - All file/folder references in the report โ†’ relative markdown links from the output file's directory (ยง1).
171
+ - Any /wb* commands cited โ†’ full-syntax form (ยง2).
172
+
173
+ 6. END THE FILE WITH:
174
+
175
+ ## ๐Ÿงญ What's Next?
176
+
177
+ Run `/wbNext <target_folder>` to get a current, ranked list of next actions for this scope.
178
+
179
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
180
+ โ”โ”โ” AUTO-APPEND FOOTER โ”โ”โ”
181
+
182
+ At the VERY END of the file (after "What's Next?"), you MUST append the `## ๐Ÿ“‚ Generated Files (__YYYYMMDD__)` cross-link footer. Do NOT use simple tables. You MUST use the rich "Tier 1" layout from `_shared/output_conventions.md` ยง5.
183
+
184
+ Format required:
185
+ ```markdown
186
+ ---
187
+ ## ๐Ÿ“‚ Generated Files (__YYYYMMDD__)
188
+ > Auto-appended per `_shared/output_conventions.md` ยง5. Same-level snapshot of top-level command outputs at write time.
189
+
190
+ ### ๐Ÿ“š Base Reference Files
191
+ | Type | File | Description |
192
+ |---|---|---|
193
+ | Foundational | [context.md](../../../../../context.md) | Permanent Identity and Architecture (Source of Truth) |
194
+ | Snapshot | [context_<scope>_<date>.md](../contexts/context_<scope>_<date>.md) | Daily snapshot used for current session context |
195
+ | Foundational | [dev.md](../../../../../dev.md) | Permanent Development Commands and Status |
196
+
197
+ ### Global Files (`core2/` monorepo root)
198
+ | Category | File | Source Command |
199
+ |---|---|---|
200
+ | Reports | [audit_core2_<date>.md](../../../../../../../../../../.wb/workflows/reports/<YYYY>/<MM>/<DD>/audits/audit_core2_<date>.md) | `/wbAudit core2/` |
201
+ | Reports | [plan_core2_<date>.md](../../../../../../../../../../.wb/workflows/reports/<YYYY>/<MM>/<DD>/plans/plan_core2_<date>.md) | `/wbPlan core2/` |
202
+ | Tracks | [track_core2_<date>.md](../../../../../../../../../../.wb/workflows/tracks/<YYYY>/<MM>/<DD>/track_core2_<date>.md) | `/wbTrack core2/` |
203
+
204
+ <details>
205
+ <summary>๐Ÿ“‚ Sub-Package: [Active Package Name]</summary>
206
+
207
+ | Category | File | Source Command |
208
+ |---|---|---|
209
+ | Reports | [audit_subpkg_<date>.md](../../../../../../../../../../apps/wb-core/subpkg/.wb/workflows/reports/<YYYY>/<MM>/<DD>/audits/audit_subpkg_<date>.md) | `/wbAudit` |
210
+
211
+ </details>
212
+ ```
213
+ ```