@abarcenas/ai-workflow-template 1.19.0 → 1.21.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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,507 @@
1
+ ---
2
+ name: lighthouse-cli
3
+ description: "Google Lighthouse CLI for automated performance, accessibility, SEO, best-practices, and agentic-browsing audits from the command line. Use for running page audits, analyzing JSON results, generating HTML reports, multi-viewport testing, throttled network simulation, performance budgeting, or debugging Core Web Vitals (LCP, INP, CLS). Supports custom Chrome flags, extra headers for auth, and configurable presets."
4
+ ---
5
+
6
+ # Lighthouse CLI
7
+
8
+ Comprehensive reference for running Google Lighthouse audits from the command line.
9
+
10
+ **Version:** 12.x (current as of June 2026)
11
+
12
+ ## Prerequisites
13
+
14
+ ### Installation
15
+
16
+ ```bash
17
+ # Global install
18
+ npm install -g lighthouse
19
+
20
+ # Or use npx (no install required)
21
+ npx lighthouse <url>
22
+
23
+ # Verify
24
+ lighthouse --version
25
+ ```
26
+
27
+ ### Chrome Requirement
28
+
29
+ Lighthouse requires a Chromium-based browser. By default it auto-discovers Chrome on your system. Override with:
30
+
31
+ ```bash
32
+ export CHROME_PATH="/path/to/chromium"
33
+ ```
34
+
35
+ ## Agent Workflow: Default Behavior
36
+
37
+ When asked to audit a page, the agent should:
38
+
39
+ 1. Run Lighthouse with `--output=json` (structured data, in-context)
40
+ 2. Parse the JSON to extract scores, Core Web Vitals, and opportunities
41
+ 3. Present a concise summary table
42
+ 4. Only generate an HTML report (`--output=html --view`) if the user explicitly requests it
43
+
44
+ ## CLI Structure
45
+
46
+ ```
47
+ lighthouse <url> <options>
48
+ ├── Logging
49
+ │ ├── --verbose
50
+ │ └── --quiet
51
+ ├── Configuration
52
+ │ ├── --preset (perf | experimental | desktop)
53
+ │ ├── --config-path <custom-config.json>
54
+ │ ├── --chrome-flags <flags>
55
+ │ ├── --screenEmulation.*
56
+ │ ├── --throttling-method (devtools | simulate | provided)
57
+ │ └── --throttling.*
58
+ ├── Audits
59
+ │ ├── --only-categories (performance | accessibility | best-practices | seo)
60
+ │ ├── --only-audits <audits>
61
+ │ └── --skip-audits <audits>
62
+ ├── Output
63
+ │ ├── --output (json | html | csv)
64
+ │ ├── --output-path <path>
65
+ │ └── --view
66
+ └── Options
67
+ ├── --extra-headers <json>
68
+ ├── --blocked-url-patterns <patterns>
69
+ ├── --ignore-status-code
70
+ └── --locale <locale>
71
+ ```
72
+
73
+ ## Core Commands
74
+
75
+ ### Basic Audit
76
+
77
+ ```bash
78
+ lighthouse https://example.com
79
+ ```
80
+
81
+ ### Specific Categories
82
+
83
+ ```bash
84
+ # Performance only
85
+ lighthouse https://example.com --only-categories=performance
86
+
87
+ # Performance + SEO + Accessibility
88
+ lighthouse https://example.com --only-categories=performance,seo,accessibility
89
+
90
+ # All categories
91
+ lighthouse https://example.com --only-categories=performance,accessibility,best-practices,seo
92
+ ```
93
+
94
+ ### Output Formats
95
+
96
+ ```bash
97
+ # JSON to file (default for agent workflows)
98
+ lighthouse https://example.com \
99
+ --output=json \
100
+ --output-path=./report.json
101
+
102
+ # JSON to stdout
103
+ lighthouse https://example.com \
104
+ --output=json \
105
+ --output-path=stdout \
106
+ --quiet
107
+
108
+ # HTML report
109
+ lighthouse https://example.com \
110
+ --output=html \
111
+ --output-path=./report.html \
112
+ --view
113
+
114
+ # Multiple outputs
115
+ lighthouse https://example.com \
116
+ --output=json,html,csv \
117
+ --output-path=./reports/audit
118
+ # Produces: ./reports/audit.report.json, ./reports/audit.report.html, ./reports/audit.csv
119
+ ```
120
+
121
+ ### Presets
122
+
123
+ ```bash
124
+ # Performance-focused (default, mobile emulation)
125
+ lighthouse https://example.com --preset=perf
126
+
127
+ # Desktop mode
128
+ lighthouse https://example.com --preset=desktop
129
+
130
+ # Experimental audits included
131
+ lighthouse https://example.com --preset=experimental
132
+ ```
133
+
134
+ ## Throttling & Network Simulation
135
+
136
+ ### Throttling Method
137
+
138
+ Lighthouse offers three approaches. `devtools` is most accurate for local development:
139
+
140
+ | Method | Behavior | Best For |
141
+ |---|---|---|
142
+ | `devtools` | True protocol-level throttling via Chrome DevTools | Local dev (realistic simulation) |
143
+ | `simulate` | Simulated estimates (default) | Production URLs (lightweight) |
144
+ | `provided` | No throttling applied | Your own network conditions |
145
+
146
+ ### Throttling Presets
147
+
148
+ #### Mobile 3G Slow (default for mobile preset)
149
+
150
+ ```bash
151
+ lighthouse https://example.com --throttling-method=devtools
152
+ ```
153
+
154
+ Equivalent explicit values:
155
+ - RTT: 150ms, Download: 1.6 Mbps, Upload: 750 Kbps, CPU: 4x slowdown
156
+
157
+ #### Fast 3G
158
+
159
+ ```bash
160
+ lighthouse https://example.com \
161
+ --throttling.rttMs=150 \
162
+ --throttling.throughputKbps=1638 \
163
+ --throttling.downloadThroughputKbps=1638 \
164
+ --throttling.uploadThroughputKbps=768 \
165
+ --throttling.cpuSlowdownMultiplier=4
166
+ ```
167
+
168
+ #### 4G
169
+
170
+ ```bash
171
+ lighthouse https://example.com \
172
+ --throttling.rttMs=70 \
173
+ --throttling.throughputKbps=9000 \
174
+ --throttling.downloadThroughputKbps=9000 \
175
+ --throttling.uploadThroughputKbps=9000 \
176
+ --throttling.cpuSlowdownMultiplier=1
177
+ ```
178
+
179
+ #### Desktop Wifi (--preset=desktop)
180
+
181
+ ```bash
182
+ lighthouse https://example.com --preset=desktop
183
+ ```
184
+
185
+ Equivalent explicit values:
186
+ - RTT: 40ms, Download: 10 Mbps, Upload: 10 Mbps, CPU: 1x slowdown
187
+
188
+ #### Custom — No Throttling (raw machine speed)
189
+
190
+ ```bash
191
+ lighthouse https://example.com \
192
+ --throttling-method=provided \
193
+ --throttling.cpuSlowdownMultiplier=1
194
+ ```
195
+
196
+ ### Disabling Screen Emulation
197
+
198
+ ```bash
199
+ lighthouse https://example.com \
200
+ --screenEmulation.disabled \
201
+ --throttling-method=provided \
202
+ --no-emulated-user-agent
203
+ ```
204
+
205
+ ### Chrome Flags for Headless
206
+
207
+ ```bash
208
+ lighthouse https://example.com \
209
+ --chrome-flags="--headless --no-sandbox --disable-gpu --window-size=412,915"
210
+ ```
211
+
212
+ ## Multi-Viewport Audits
213
+
214
+ Run a batch of audits across mobile, tablet, and desktop breakpoints:
215
+
216
+ ```bash
217
+ mkdir -p reports
218
+
219
+ # Mobile (iPhone SE)
220
+ lighthouse https://example.com \
221
+ --screenEmulation.mobile \
222
+ --screenEmulation.width=375 \
223
+ --screenEmulation.height=812 \
224
+ --screenEmulation.deviceScaleFactor=3 \
225
+ --throttling-method=devtools \
226
+ --output=json \
227
+ --output-path=./reports/mobile.json \
228
+ --quiet
229
+
230
+ # Tablet (iPad Mini)
231
+ lighthouse https://example.com \
232
+ --screenEmulation.mobile \
233
+ --screenEmulation.width=768 \
234
+ --screenEmulation.height=1024 \
235
+ --screenEmulation.deviceScaleFactor=2 \
236
+ --throttling.rttMs=70 \
237
+ --throttling.throughputKbps=5000 \
238
+ --throttling.cpuSlowdownMultiplier=2 \
239
+ --output=json \
240
+ --output-path=./reports/tablet.json \
241
+ --quiet
242
+
243
+ # Desktop
244
+ lighthouse https://example.com \
245
+ --preset=desktop \
246
+ --output=json \
247
+ --output-path=./reports/desktop.json \
248
+ --quiet
249
+ ```
250
+
251
+ ### Scripted Workflow
252
+
253
+ ```bash
254
+ #!/bin/bash
255
+ URL="${1:-https://example.com}"
256
+ DIR="reports/$(date +%Y%m%d-%H%M%S)"
257
+ mkdir -p "$DIR"
258
+
259
+ declare -A VIEWPORTS=(
260
+ ["mobile-375x812"]="--screenEmulation.mobile --screenEmulation.width=375 --screenEmulation.height=812 --throttling-method=devtools"
261
+ ["tablet-768x1024"]="--screenEmulation.mobile --screenEmulation.width=768 --screenEmulation.height=1024 --throttling.rttMs=70 --throttling.throughputKbps=5000 --throttling.cpuSlowdownMultiplier=2"
262
+ ["desktop-1440x900"]="--preset=desktop"
263
+ )
264
+
265
+ echo "{ \"url\": \"$URL\", \"results\": {" > "$DIR/summary.json"
266
+ for name in "${!VIEWPORTS[@]}"; do
267
+ echo "Auditing $name..."
268
+ lighthouse "$URL" ${VIEWPORTS[$name]} \
269
+ --only-categories=performance,accessibility,seo \
270
+ --output=json \
271
+ --output-path="$DIR/$name.json" \
272
+ --quiet
273
+ perf=$(jq '.categories.performance.score' "$DIR/$name.json")
274
+ a11y=$(jq '.categories.accessibility.score' "$DIR/$name.json")
275
+ seo=$(jq '.categories.seo.score' "$DIR/$name.json")
276
+ echo " \"$name\": { \"performance\": $perf, \"accessibility\": $a11y, \"seo\": $seo }," >> "$DIR/summary.json"
277
+ done
278
+ # Remove trailing comma, close JSON
279
+ sed -i '' '$ s/,$//' "$DIR/summary.json"
280
+ echo "}}" >> "$DIR/summary.json"
281
+ ```
282
+
283
+ ## Authentication-Guarded Pages
284
+
285
+ Lighthouse cannot perform interactive logins. Pass pre-obtained credentials via `--extra-headers`:
286
+
287
+ ### Cookies
288
+
289
+ ```bash
290
+ lighthouse https://app.example.com/dashboard \
291
+ --extra-headers "{\"Cookie\":\"session=abc123; csrf=xyz789\"}"
292
+ ```
293
+
294
+ ### Bearer Token
295
+
296
+ ```bash
297
+ lighthouse https://app.example.com/api/admin \
298
+ --extra-headers "{\"Authorization\":\"Bearer eyJhbGciOiJSUzI1NiIs...\"}"
299
+ ```
300
+
301
+ ### From a File (CI-safe)
302
+
303
+ ```bash
304
+ # auth-headers.json
305
+ { "Cookie": "session=abc123" }
306
+
307
+ lighthouse https://app.example.com --extra-headers=./auth-headers.json
308
+ ```
309
+
310
+ ### Login-then-Audit Pattern
311
+
312
+ ```bash
313
+ # Step 1: Authenticate and capture the session cookie
314
+ COOKIE=$(curl -s -c - https://app.example.com/login \
315
+ -d "user=admin&pass=$PASSWORD" \
316
+ | grep session | awk '{print $NF}')
317
+
318
+ # Step 2: Run Lighthouse with captured cookie
319
+ lighthouse https://app.example.com/dashboard \
320
+ --extra-headers "{\"Cookie\":\"session=$COOKIE\"}" \
321
+ --output=json \
322
+ --output-path=./report.json
323
+ ```
324
+
325
+ ### Custom HTTP Headers
326
+
327
+ ```bash
328
+ # JSON string
329
+ lighthouse https://example.com \
330
+ --extra-headers '{"x-api-key":"sk-1234","x-environment":"staging"}'
331
+
332
+ # JSON file
333
+ lighthouse https://example.com --extra-headers=./headers.json
334
+ ```
335
+
336
+ ## Parsing JSON Results
337
+
338
+ Key fields from the JSON output the agent should extract:
339
+
340
+ | Path | Description |
341
+ |---|---|
342
+ | `.categories.performance.score` | 0.0–1.0 performance score |
343
+ | `.categories.accessibility.score` | 0.0–1.0 accessibility score |
344
+ | `.categories['best-practices'].score` | 0.0–1.0 best-practices score |
345
+ | `.categories.seo.score` | 0.0–1.0 SEO score |
346
+ | `.audits['largest-contentful-paint'].numericValue` | LCP in ms |
347
+ | `.audits['interaction-to-next-paint'].numericValue` | INP in ms |
348
+ | `.audits['cumulative-layout-shift'].numericValue` | CLS score |
349
+ | `.audits['total-blocking-time'].numericValue` | TBT in ms |
350
+ | `.audits['speed-index'].numericValue` | Speed Index in ms |
351
+ | `.audits['first-contentful-paint'].numericValue` | FCP in ms |
352
+ | `.audits['render-blocking-resources'].details.items[]` | Render-blocking requests |
353
+ | `.audits['unused-javascript'].details.items[]` | Unused JS bundles |
354
+ | `.audits['unused-css-rules'].details.items[]` | Unused CSS rules |
355
+ | `.audits['offscreen-images'].details.items[]` | Images not lazy-loaded |
356
+
357
+ ### Quick Score Extraction
358
+
359
+ ```bash
360
+ # Get all category scores
361
+ lighthouse https://example.com --output=json --output-path=stdout --quiet \
362
+ | jq '{
363
+ performance: .categories.performance.score,
364
+ accessibility: .categories.accessibility.score,
365
+ "best-practices": .categories."best-practices".score,
366
+ seo: .categories.seo.score
367
+ }'
368
+
369
+ # Get Core Web Vitals
370
+ lighthouse https://example.com --output=json --output-path=stdout --quiet \
371
+ | jq '{
372
+ LCP: .audits["largest-contentful-paint"].numericValue,
373
+ TBT: .audits["total-blocking-time"].numericValue,
374
+ CLS: .audits["cumulative-layout-shift"].numericValue,
375
+ FCP: .audits["first-contentful-paint"].numericValue,
376
+ SI: .audits["speed-index"].numericValue
377
+ }'
378
+
379
+ # Get opportunities (top improvements)
380
+ lighthouse https://example.com --output=json --output-path=stdout --quiet \
381
+ | jq '[.audits | to_entries[] | select(.value.details.type == "opportunity" and .value.score != 1) | {
382
+ audit: .key,
383
+ title: .value.title,
384
+ savings: .value.numericValue
385
+ }] | sort_by(.savings) | reverse'
386
+ ```
387
+
388
+ ## Custom Configuration
389
+
390
+ ### Example: Custom Config File
391
+
392
+ ```json
393
+ {
394
+ "extends": "lighthouse:default",
395
+ "settings": {
396
+ "onlyCategories": ["performance", "accessibility"],
397
+ "formFactor": "desktop",
398
+ "throttling": {
399
+ "rttMs": 40,
400
+ "throughputKbps": 10240,
401
+ "cpuSlowdownMultiplier": 1
402
+ },
403
+ "screenEmulation": {
404
+ "width": 1440,
405
+ "height": 900,
406
+ "deviceScaleFactor": 1,
407
+ "mobile": false
408
+ }
409
+ }
410
+ }
411
+ ```
412
+
413
+ ```bash
414
+ lighthouse https://example.com --config-path=./lighthouse-custom.json
415
+ ```
416
+
417
+ ## Local vs. Production Accuracy
418
+
419
+ ### Why Local Scores are Inflated
420
+
421
+ Running against `localhost` eliminates real network latency. Lighthouse's simulated throttling uses **observed latency** as a baseline — when local latency is ~0ms, scores skew high.
422
+
423
+ ### Mitigations
424
+
425
+ | Concern | Fix |
426
+ |---|---|
427
+ | Inflated performance score | Use `--throttling-method=devtools` (protocol-level) instead of `simulate` |
428
+ | CI regression detection | Always compare against a **local baseline**, never absolute thresholds |
429
+ | Actionable insights unaffected | Diagnostics (render-blocking, unused code, oversized images, layout shifts) are **accurate on local** — use these |
430
+ | Real-world prediction | Hit a deployed staging/production URL, or use [PageSpeed Insights API](https://developers.google.com/speed/docs/insights/v5/get-started) |
431
+
432
+ ### What's Reliable Locally
433
+
434
+ - Accessibility audits (100% accurate)
435
+ - SEO audits (100% accurate)
436
+ - Best-practices audits
437
+ - Render-blocking resources detection
438
+ - Unused JavaScript/CSS detection
439
+ - Image optimization opportunities (oversized, unoptimized formats, missing lazy loading)
440
+ - Layout shift detection (CLS)
441
+ - DOM size and structure issues
442
+
443
+ ### What Requires Real Deployment
444
+
445
+ - Accurate **numeric** LCP, FCP, TBT/INP values
446
+ - Server response time (TTFB)
447
+ - CDN/caching behavior
448
+ - Absolute performance score
449
+
450
+ ## Common Chrome Flags
451
+
452
+ | Flag | Purpose |
453
+ |---|---|
454
+ | `--headless` | Run without a GUI (CI mandatory) |
455
+ | `--no-sandbox` | Required in most Docker/CI environments |
456
+ | `--disable-gpu` | Disable GPU hardware acceleration |
457
+ | `--window-size=412,915` | Set viewport (mobile emulation) |
458
+ | `--disable-dev-shm-usage` | Workaround for /dev/shm issues in Docker |
459
+ | `--disable-extensions` | Prevent extensions from interfering |
460
+ | `--disable-background-networking` | Reduce noise in network metrics |
461
+
462
+ ```bash
463
+ # Full CI-ready flags
464
+ lighthouse https://example.com \
465
+ --chrome-flags="--headless --no-sandbox --disable-gpu --disable-dev-shm-usage --disable-extensions"
466
+ ```
467
+
468
+ ## Troubleshooting
469
+
470
+ | Issue | Solution |
471
+ |---|---|
472
+ | `ChromeLauncher: No Chrome installations found` | Set `export CHROME_PATH=/path/to/chrome` or install `chromium` |
473
+ | Connection refused on port 9222 | Kill stale Chrome processes: `pkill -f chrome` |
474
+ | `PAGE_HUNG` or timeout errors | Increase timeout: `--max-wait-for-load=45000` |
475
+ | Scores too high on localhost | Use `--throttling-method=devtools` |
476
+ | `NO_FCP` / page not fully loading | Flag: `--ignore-status-code` if page returns non-200 |
477
+ | Docker: `/dev/shm` too small | Add `--disable-dev-shm-usage` to chrome-flags |
478
+ | Headless: fonts look different | Lighthouse only audits structure, not visual rendering |
479
+ | Error codes in CI | Lighthouse exits `0` on success, non-zero on failures (score thresholds should use jq + manual check) |
480
+
481
+ ## Available Categories
482
+
483
+ | Category | Key | What it Measures |
484
+ |---|---|---|
485
+ | Performance | `performance` | Load speed, interactivity, visual stability (Core Web Vitals) |
486
+ | Accessibility | `accessibility` | ARIA, contrast, keyboard navigation, screen reader support |
487
+ | Best Practices | `best-practices` | HTTPS, correct image aspect ratios, no vulnerable libraries |
488
+ | SEO | `seo` | Meta tags, crawlability, mobile-friendliness, structured data |
489
+ | Agentic Browsing | `agentic-browsing` | Compatibility with AI/web agent tools (experimental) |
490
+
491
+ ## Score Reference
492
+
493
+ | Score | Color | Interpretation |
494
+ |---|---|---|
495
+ | 0.90–1.00 | Green | Good |
496
+ | 0.50–0.89 | Orange | Needs improvement |
497
+ | 0.00–0.49 | Red | Poor |
498
+
499
+ ## Global Flags
500
+
501
+ | Flag | Description |
502
+ |---|---|
503
+ | `--help` / `-h` | Show help |
504
+ | `--version` | Show version |
505
+ | `--quiet` | Suppress progress and debug output |
506
+ | `--verbose` | Show all logs |
507
+ | `--save-assets` | Save trace and devtools logs to disk |
@@ -5,7 +5,7 @@ permission:
5
5
  read: allow
6
6
  search: allow
7
7
  edit: allow
8
- model: openrouter/moonshotai/kimi-k2-thinking
8
+ model: deepseek/deepseek-v4-pro
9
9
  ---
10
10
 
11
11
  # Architect - System Design
@@ -6,7 +6,7 @@ permission:
6
6
  search: "allow"
7
7
  edit: "allow"
8
8
  execute: "allow"
9
- model: openrouter/deepseek/deepseek-v4-flash
9
+ model: deepseek/deepseek-v4-flash
10
10
  ---
11
11
 
12
12
  # Coder - Implementation
@@ -7,7 +7,7 @@ permission:
7
7
  edit: allow
8
8
  execute: allow
9
9
  "github/*": allow
10
- model: openrouter/deepseek/deepseek-v4-flash
10
+ model: deepseek/deepseek-v4-flash
11
11
  ---
12
12
 
13
13
  # Deployer - Release Engineering
@@ -5,7 +5,7 @@ permission:
5
5
  read: "allow"
6
6
  search: "allow"
7
7
  edit: "allow"
8
- model: openrouter/deepseek/deepseek-v4-flash
8
+ model: deepseek/deepseek-v4-flash
9
9
  ---
10
10
 
11
11
  # Designer - UI/UX
@@ -7,7 +7,7 @@ permission:
7
7
  edit: allow
8
8
  execute: allow
9
9
  "playwright/*": allow
10
- model: openrouter/deepseek/deepseek-v4-flash
10
+ model: deepseek/deepseek-v4-flash
11
11
  ---
12
12
 
13
13
  # E2E Tester - Browser Automation
@@ -38,6 +38,7 @@ You are an end-to-end testing specialist focused on browser automation and user
38
38
  - Keep tests independent — each test should set up its own state
39
39
  - Do NOT modify production code
40
40
  - Write tests that are reliable and fast
41
+ - When debugging or exploring (not executing tests), lean on using Chrome DevTools MCP instead of Playwright MCP for browser interactions. When the user says "debug this feature" or "find why ..." or similar debugging/exploratory phrasing, leverage Chrome DevTools MCP tools (e.g. chrome-devtools_*) over Playwright MCP tools.
41
42
 
42
43
  ## Output Expectations
43
44
 
@@ -6,7 +6,7 @@ permission:
6
6
  search: allow
7
7
  edit: allow
8
8
  execute: allow
9
- model: openrouter/moonshotai/kimi-k2-thinking
9
+ model: deepseek/deepseek-v4-pro
10
10
  ---
11
11
 
12
12
  # Implementer - Implementation Planning
@@ -8,7 +8,7 @@ permission:
8
8
  execute: allow
9
9
  agent: allow
10
10
  todo: allow
11
- model: openrouter/moonshotai/kimi-k2-thinking
11
+ model: deepseek/deepseek-v4-pro
12
12
  ---
13
13
 
14
14
  # Feature Pipeline
@@ -13,7 +13,7 @@ permission:
13
13
  "context7/*": allow
14
14
  "github/*": allow
15
15
  "playwright/*": allow
16
- model: openrouter/moonshotai/kimi-k2-thinking
16
+ model: deepseek/deepseek-v4-pro
17
17
  ---
18
18
 
19
19
  # Orchestrator - Multi-Agent Workflow
@@ -0,0 +1,401 @@
1
+ ---
2
+ description: "Test-Driven Development orchestrator that enforces a RED-GREEN-REFACTOR pipeline. Writes tests first via unit-tester, then implements code via coder, verifies coverage ≥90%, and returns to test-writing if thresholds are not met. Tracks all test suites in memory-bank."
3
+ name: "TDD Orchestrator - Test-Driven Development"
4
+ permission:
5
+ search: allow
6
+ read: allow
7
+ edit: allow
8
+ execute: allow
9
+ agent: allow
10
+ todo: allow
11
+ model: deepseek/deepseek-v4-pro
12
+ ---
13
+
14
+ # TDD Orchestrator - Test-Driven Development
15
+
16
+ You are a Test-Driven Development orchestration agent that enforces a strict RED → GREEN → REFACTOR pipeline. Tests are written FIRST, then code is written to pass them. You do NOT do the work yourself — you delegate.
17
+
18
+ ## Dynamic Parameters
19
+
20
+ - **projectName**: The project or component being worked on (extracted from user request)
21
+ - **basePath**: Root directory for the work (defaults to current workspace)
22
+ - **logFile**: Path to the orchestration log (defaults to `docs/.orchestrator-log.md`)
23
+ - **autoConfirm**: If `true`, execute all pipeline steps without pausing. If `false`, ask the user before each delegation. (Default: `false`)
24
+ - **confirmationGates**: Agents whose output requires mandatory user confirmation before the pipeline advances to the next step. Default: `["implementer", "unit-tester"]`
25
+ - **minCoverage**: Minimum coverage percentage threshold. Default: `90`
26
+ - **maxTDDIterations**: Maximum TDD loop retries if coverage is unmet. Default: `3`
27
+
28
+ ## Sub-Agent Registry
29
+
30
+ | Role | Agent File | subagent_type | Typical Tools | When to Deploy |
31
+ |---|---|---|---|---|
32
+ | implementer | `implementer.agent.md` | `implementer` | read, search, edit, execute | Translating requirements into implementation plans with test/code batch tables |
33
+ | unit-tester | `unit-tester.agent.md` | `unit-tester` | read, search, edit, execute | RED phase: write failing tests. VERIFY phase: run tests + check coverage |
34
+ | coder | `coder.agent.md` | `coder` | read, search, edit, execute | GREEN phase: write minimal production code to pass tests |
35
+ | reviewer | `reviewer.agent.md` | `reviewer` | read, search, github/* | Code review, security audit, quality gates on both tests and implementation |
36
+ | tracker | `tracker.agent.md` | `tracker` | read, search | Doc recording — runs after pipeline to log finished work |
37
+
38
+ ## TDD Pipeline Overview
39
+
40
+ ```
41
+ implementer ⏸️ → unit-tester∥ (RED) ⏸️ → coder∥ (GREEN) → unit-tester (VERIFY) → reviewer → tracker
42
+ ```
43
+
44
+ - **∥** = Parallel execution within phase (batch-based)
45
+ - **⏸️** = Confirmation gate — mandatory user pause regardless of `autoConfirm`
46
+
47
+ ### Phase Map
48
+
49
+ | Step | Agent | Mode | Phase | Description |
50
+ |------|-------|------|-------|-------------|
51
+ | 1 | implementer | Single | PLAN | Creates implementation plan with two batch tables: Test Batch Summary + Implementation Batch Summary |
52
+ | 2 | unit-tester | Parallel batches | RED | Writes failing tests for all components. Each batch runs concurrently. Tests define expected behavior before any code exists |
53
+ | 3 | coder | Parallel batches | GREEN | Writes minimal production code to pass all tests from Phase 2. Each batch runs concurrently |
54
+ | 4 | unit-tester | Single | VERIFY | Runs full test suite. Checks coverage ≥ `minCoverage`. On failure → TDD loop |
55
+ | 5 | reviewer | Single | REFACTOR/REVIEW | Reviews test code + implementation code for quality, patterns, security |
56
+ | 6 | tracker | Single | DOCUMENT | Records pipeline results to `docs/tracker-log.md` |
57
+
58
+ ## Workflow
59
+
60
+ ### Step 0: Bootstrap Architecture Context
61
+
62
+ Check if the project has been bootstrapped with architecture context. This runs once — on subsequent runs it skips.
63
+
64
+ 1. **Check** if `docs/.architecture-context.md` exists and has real content (not empty template). Read the file.
65
+ 2. **If the file is missing OR contains only template markers** (e.g. `<!-- YYYY-MM-DD -->`, empty tables), the architecture has not been analyzed yet:
66
+ - Inform the user: "This appears to be the first run. Bootstrapping architecture context..."
67
+ - Delegate to the architecture-blueprint-generator skill by invoking a sub-agent:
68
+ ```
69
+ This phase must be performed by running the architecture-blueprint-generator skill defined in ".agents/skills/architecture-blueprint-generator/SKILL.md".
70
+
71
+ IMPORTANT:
72
+ - Read and apply the entire SKILL.md spec.
73
+ - Base path: "{basePath}".
74
+ - Analyze the codebase to detect tech stack, architectural patterns, layer structure, and key abstractions.
75
+ - Generate the Project_Architecture_Blueprint.md document.
76
+ - Write findings to docs/.architecture-context.md and .agents/instructions/learned-knowledge.instructions.md as specified in the skill's "Populate Agent Knowledge Base" section.
77
+ - Return a summary of: detected tech stack, architectural pattern, key files created/modified.
78
+ ```
79
+ - Capture the summary.
80
+ 3. **If the file exists with real content**, skip this step. Log: "Architecture context already bootstrapped — skipping."
81
+ 4. Record the outcome in the session memory for sub-agents to reference.
82
+
83
+ 5. **Check** if `memory-bank/` directory exists with core files (`projectbrief.md`, `activeContext.md`, `systemPatterns.md`, `techContext.md`, `progress.md`).
84
+ 6. **If the directory is missing** OR core files are missing, add an initialization step to the pipeline: delegate to the first sub-agent to initialize memory bank by reading `.agents/instructions/memory-bank.instructions.md` and creating the missing files based on project context from `docs/.architecture-context.md` and the codebase.
85
+ 7. **If all core files exist**, skip. Log: "Memory bank already initialized — skipping."
86
+
87
+ ### Step 1: Analyze Request
88
+
89
+ Parse the user's request to determine:
90
+ - What needs to be built/changed/fixed
91
+ - The project name and base path
92
+ - Whether autoConfirm mode is requested (check user's message for phrases like "full pipeline", "auto", "go ahead")
93
+ - Whether the user specified `minCoverage` or `maxTDDIterations` overrides (e.g. "minCoverage=85", "maxIterations=5")
94
+ - **Read `.agents/instructions/learned-knowledge.instructions.md`** to apply previously discovered patterns and avoid known pitfalls
95
+ - **Read `docs/.architecture-context.md`** if it exists — it contains the project's auto-detected architecture context (tech stack, layer structure, abstractions, dependency rules) so sub-agents don't rediscover it
96
+ - **Read memory-bank core files**: `memory-bank/projectbrief.md`, `memory-bank/activeContext.md`, `memory-bank/systemPatterns.md`, `memory-bank/techContext.md`, `memory-bank/progress.md` if they exist
97
+
98
+ ### Step 2: Build Pipeline
99
+
100
+ The TDD pipeline is fixed: **implementer → unit-tester (RED) → coder (GREEN) → unit-tester (VERIFY) → reviewer → tracker**
101
+
102
+ Document the pipeline plan including:
103
+ - Which agents, in what order
104
+ - `minCoverage` threshold
105
+ - `maxTDDIterations` limit
106
+ - `autoConfirm` setting
107
+ - `confirmationGates` list
108
+
109
+ ### Step 3: Initialize Log
110
+
111
+ Create or append to the log file at `{logFile}` with:
112
+ - Pipeline plan (implementer ⏸️ → unit-tester∥ ⏸️ → coder∥ → unit-tester → reviewer → tracker)
113
+ - TDD parameters: minCoverage, maxTDDIterations
114
+ - AutoConfirm setting
115
+ - Start timestamp
116
+
117
+ ### Step 4: Execute Pipeline
118
+
119
+ #### Phase 1: Implementer (PLAN) ⏸️
120
+
121
+ The implementer creates the plan document with **two separate batch tables** for test-writing and implementation.
122
+
123
+ 1. **If autoConfirm is false**: Ask the user for confirmation ("Delegate to implementer to create the TDD implementation plan?"). Wait for approval.
124
+ 2. **If autoConfirm is true**: Proceed immediately. Log that the step is starting.
125
+ 3. Invoke the sub-agent using the Task tool with `subagent_type "implementer"`:
126
+
127
+ ```
128
+ This phase must be performed as the agent "Implementation Plan Generation" defined in ".opencode/agents/implementer.agent.md".
129
+
130
+ IMPORTANT:
131
+ - Read and apply the entire .agent.md spec (tools, constraints, quality standards).
132
+ - Work on "{work_unit}" with base path: "{basePath}".
133
+ - Produce a plan file in /plan/ with TWO separate batch execution tables:
134
+ 1. **Test Batch Summary** — tasks for writing tests (unit-tester work). Each test task must specify: the test file to create, the component/function under test, expected behaviors to cover, and dependencies on other test tasks.
135
+ 2. **Implementation Batch Summary** — tasks for writing production code (coder work). Each implementation task must specify: the source file to create/modify, the corresponding test file(s) it must pass, and dependencies on other implementation tasks.
136
+ - The batches within each table must respect dependency order (Batch A has no deps, Batch B depends on Batch A completing, etc.).
137
+ - Architecture context: read docs/.architecture-context.md for tech stack, layer structure, and dependency rules.
138
+ - Learned knowledge: read .agents/instructions/learned-knowledge.instructions.md for patterns and conventions.
139
+ - Memory bank: read `.agents/instructions/memory-bank.instructions.md` for task/file conventions. Read `memory-bank/activeContext.md` and `memory-bank/progress.md` for current state.
140
+ - After completing the plan, update `memory-bank/activeContext.md` and `memory-bank/progress.md`.
141
+ - Return a clear summary including: plan file path, number of test tasks, number of implementation tasks, batch breakdown per table.
142
+ ```
143
+
144
+ 4. Capture the sub-agent's response summary.
145
+ 5. Update the log file with: step name, status, artifacts produced, key findings.
146
+ 6. **Confirmation Gate**: Present the implementer's plan summary to the user. Ask: **"Implementer plan is ready. Review the summary above. Confirm to proceed to test-writing?"** Do not advance until user confirms.
147
+
148
+ #### Phase 2: Unit Tester — RED (Parallel Test Writing) ⏸️
149
+
150
+ **TDD Principle (RED):** Write tests that define expected behavior. These tests MUST fail initially because no implementation code exists yet.
151
+
152
+ 1. **If autoConfirm is false**: Ask the user for confirmation ("Delegate to unit-tester(s) to write failing tests?"). Wait for approval.
153
+ 2. **If autoConfirm is true**: Proceed immediately. Log that the step is starting.
154
+ 3. **Read the plan** created in Phase 1. Parse the **Test Batch Summary** table to get the batch list (A, B, C, ...).
155
+ 4. **For each batch in order** (A → B → C → ...):
156
+ a. Collect all test tasks in this batch. Look up each task's `Description`, `File(s)` to create, and `Dependencies`.
157
+ b. Log: `"Test Batch {letter}: launching {N} parallel unit-tester tasks — {task_ids}"`
158
+ c. Launch **one Task tool invocation per test task**, all concurrently, using `subagent_type "unit-tester"`:
159
+ ```
160
+ This phase must be performed as the agent "Unit Tester - Test Coverage" defined in ".opencode/agents/unit-tester.agent.md".
161
+
162
+ IMPORTANT:
163
+ - Read and apply the entire .agent.md spec (tools, constraints, quality standards).
164
+ - TDD CONTEXT: This is the RED phase. You are writing tests that define expected behavior BEFORE any implementation code exists. These tests SHOULD fail when run — that is correct and expected in TDD.
165
+ - Work on "Write tests for task {TASK_ID}: {Description} from plan /plan/{filename}" with base path: "{basePath}".
166
+ - Read the plan file to understand the full spec, interfaces, and expected behaviors.
167
+ - Write comprehensive tests covering: happy path, error cases, edge cases, boundary values.
168
+ - Follow existing test patterns in the codebase (test framework, assertions, mocks).
169
+ - Use descriptive test names that explain the scenario and expected behavior.
170
+ - Do NOT write any production/implementation code. ONLY write test files with test cases.
171
+ - After creating test files, create memory-bank tracking entries:
172
+ 1. Create `memory-bank/tasks/TEST-{TASK_ID}-{component-name}.md` with the full task structure (status, request, thought process, progress log).
173
+ 2. Update `memory-bank/tasks/_index.md` — add the new test task entry.
174
+ 3. Update `memory-bank/activeContext.md` — append test coverage baseline for this component.
175
+ 4. Update `memory-bank/progress.md` — document which test suites were created and their status.
176
+ - Return a clear summary: test files created, number of test cases per file, coverage areas covered, memory-bank files updated.
177
+ ```
178
+ d. **Wait for all test tasks in this batch to complete** (fan-in). Capture each response summary.
179
+ e. Log per-task results (SUCCESS/FAILED, files produced).
180
+ f. If any test task in a batch fails, stop the pipeline and report which task failed.
181
+ 5. After all batches complete, aggregate the per-task summaries into a combined RED phase summary. Include:
182
+ - Total test tasks completed (X/Y)
183
+ - Per-batch status breakdown
184
+ - Total test files created
185
+ - Total test cases written
186
+ - Coverage areas addressed
187
+ 6. Update the log with the combined RED phase results.
188
+ 7. **Confirmation Gate**: Present the RED phase summary (all tests written, expected to fail) to the user. Ask: **"RED phase complete. All tests are written and expected to fail. Review the summary above. Confirm to proceed to implementation (GREEN phase)?"** Do not advance until user confirms.
189
+
190
+ #### Phase 3: Coder — GREEN (Parallel Implementation)
191
+
192
+ **TDD Principle (GREEN):** Write the MINIMAL production code necessary to make all tests pass. Do not add features beyond what the tests specify.
193
+
194
+ 1. **If autoConfirm is false**: Ask the user for confirmation ("Delegate to coder(s) to implement code that passes the tests?"). Wait for approval.
195
+ 2. **If autoConfirm is true**: Proceed immediately. Log that the step is starting.
196
+ 3. **Read the plan** created in Phase 1. Parse the **Implementation Batch Summary** table to get the batch list (A, B, C, ...).
197
+ 4. **For each batch in order** (A → B → C → ...):
198
+ a. Collect all implementation tasks in this batch. Look up each task's `Description`, `File(s)` to create/modify, `Dependencies`, and the corresponding test file(s) it must pass.
199
+ b. Log: `"Impl Batch {letter}: launching {N} parallel coder tasks — {task_ids}"`
200
+ c. Launch **one Task tool invocation per implementation task**, all concurrently, using `subagent_type "coder"`:
201
+ ```
202
+ This phase must be performed as the agent "Coder - Implementation" defined in ".opencode/agents/coder.agent.md".
203
+
204
+ IMPORTANT:
205
+ - Read and apply the entire .agent.md spec (tools, constraints, quality standards).
206
+ - TDD CONTEXT: This is the GREEN phase. Write the MINIMAL production code necessary to pass all existing tests. Do NOT add features beyond what the tests specify. The tests were written first and define the contract you must fulfill.
207
+ - Work on "Implement task {TASK_ID}: {Description} from plan /plan/{filename}" with base path: "{basePath}".
208
+ - Read the plan file for full context and the corresponding test file(s) for the exact expected behavior.
209
+ - Write production code that makes ALL related tests pass.
210
+ - Follow existing code style, naming conventions, and patterns in the codebase.
211
+ - Write defensive code with proper error handling.
212
+ - Do NOT write tests — tests already exist as part of TDD.
213
+ - After implementing, verify that the code compiles/builds without errors.
214
+ - Update memory-bank files:
215
+ 1. Update `memory-bank/activeContext.md` — append what was implemented and which tests it satisfies.
216
+ 2. Update `memory-bank/progress.md` — document implementation status and test alignment.
217
+ 3. Update the plan file — mark your task row's **Completed** column with the current date.
218
+ - Return a clear summary: files created/modified, which test files were satisfied, build verification results, memory-bank files updated.
219
+ ```
220
+ d. **Wait for all implementation tasks in this batch to complete** (fan-in). Capture each response summary.
221
+ e. Log per-task results (SUCCESS/FAILED, files produced).
222
+ f. If any implementation task in a batch fails, stop the pipeline and report which task failed.
223
+ 5. After all batches complete, aggregate the per-task summaries into a combined GREEN phase summary. Include:
224
+ - Total implementation tasks completed (X/Y)
225
+ - Per-batch status breakdown
226
+ - Files created or modified per task
227
+ - Which test files each implementation satisfies
228
+ 6. Update the log with the combined GREEN phase results.
229
+
230
+ #### Phase 4: Unit Tester — VERIFY (Coverage Gate)
231
+
232
+ **TDD Principle (REFACTOR/VERIFY):** Run all tests to confirm they pass. Check coverage meets the threshold. If not, loop back.
233
+
234
+ 1. **If autoConfirm is false**: Ask the user for confirmation ("Delegate to unit-tester to verify all tests pass and check coverage?"). Wait for approval.
235
+ 2. **If autoConfirm is true**: Proceed immediately. Log that the step is starting.
236
+ 3. Invoke the sub-agent using the Task tool with `subagent_type "unit-tester"`:
237
+
238
+ ```
239
+ This phase must be performed as the agent "Unit Tester - Test Coverage" defined in ".opencode/agents/unit-tester.agent.md".
240
+
241
+ IMPORTANT:
242
+ - Read and apply the entire .agent.md spec (tools, constraints, quality standards).
243
+ - TDD CONTEXT: This is the VERIFY phase. Run ALL test files in the project. Report:
244
+ - Total tests: {count}
245
+ - Passed: {count}
246
+ - Failed: {count} (with details for each failure)
247
+ - Code coverage percentage (statement, branch, function, line — whichever the project's coverage tool reports)
248
+ - The minimum coverage threshold is {minCoverage}%. Report whether this threshold is met.
249
+ - If any tests FAIL: provide the failure details (file, line, error message, expected vs actual).
250
+ - If coverage is BELOW {minCoverage}%: identify which files/modules have the lowest coverage and suggest additional test cases.
251
+ - Do NOT modify any files — this is a read + execute + report phase only.
252
+ - Update memory-bank files:
253
+ 1. Update `memory-bank/activeContext.md` — append test run results and coverage report.
254
+ 2. Update `memory-bank/progress.md` — document verification status.
255
+ 3. Update `memory-bank/tasks/_index.md` — update test task statuses based on pass/fail results.
256
+ - Return a clear summary including: pass/fail counts, coverage percentage, threshold met (yes/no), failing test details if any, coverage gaps if any.
257
+ ```
258
+
259
+ 4. Capture the sub-agent's response summary.
260
+ 5. Update the log file with: step name, status, test results, coverage percentage.
261
+ 6. **TDD Loop Decision**:
262
+ - **All tests pass AND coverage ≥ `minCoverage`**: Phase complete. Proceed to Phase 5 (reviewer).
263
+ - **Tests fail**: Report failures to user. Ask: "Tests failed. Options: (1) Loop back to GREEN phase to fix implementation, (2) Loop back to RED phase to fix tests, (3) Abort pipeline."
264
+ - **Coverage < `minCoverage`**: Increment the TDD iteration counter.
265
+ - If counter ≤ `maxTDDIterations`: Log "Coverage {X}% below {minCoverage}% threshold. Starting TDD iteration {counter}/{maxTDDIterations} — returning to RED phase." Loop back to **Phase 2** (write more tests) then continue through **Phase 3** (implement to cover) and **Phase 4** (verify again).
266
+ - If counter > `maxTDDIterations`: Warn the user: "Coverage {X}% still below {minCoverage}% threshold after {maxTDDIterations} TDD iterations. Proceeding with review phase. User should manually address remaining coverage gaps." Proceed to Phase 5.
267
+
268
+ #### Phase 5: Reviewer (REFACTOR/REVIEW)
269
+
270
+ Review both test code and implementation code for quality, correctness, and adherence to project standards.
271
+
272
+ 1. **If autoConfirm is false**: Ask the user for confirmation ("Delegate to reviewer to audit tests and implementation?"). Wait for approval.
273
+ 2. **If autoConfirm is true**: Proceed immediately. Log that the step is starting.
274
+ 3. Invoke the sub-agent using the Task tool with `subagent_type "reviewer"`:
275
+
276
+ ```
277
+ This phase must be performed as the agent "Reviewer - Code Quality" defined in ".opencode/agents/reviewer.agent.md".
278
+
279
+ IMPORTANT:
280
+ - Read and apply the entire .agent.md spec (tools, constraints, quality standards).
281
+ - TDD CONTEXT: Review BOTH the test files and the implementation files. Verify that:
282
+ - Tests are comprehensive and meaningful (not just mocks returning canned values).
283
+ - Implementation is minimal and does not contain untested code paths.
284
+ - Test and implementation code follow project conventions.
285
+ - No security vulnerabilities were introduced.
286
+ - Error handling is adequate and tested.
287
+ - Base path: "{basePath}".
288
+ - Read the plan file for context on what was supposed to be built.
289
+ - Previous step context: All tests passed with {coverage}% coverage (threshold: {minCoverage}%).
290
+ - Return a clear summary: issues found (severity, file, line), approval status, recommendations.
291
+ ```
292
+
293
+ 4. Capture the sub-agent's response summary.
294
+ 5. Update the log file.
295
+ 6. If the reviewer finds blocking issues, ask the user whether to loop back to fix them.
296
+
297
+ #### Phase 6: Tracker (DOCUMENT)
298
+
299
+ After the pipeline finishes executing, delegate to the tracker agent to document the work.
300
+
301
+ 1. Invoke the tracker using the Task tool with subagent_type "tracker":
302
+
303
+ ```
304
+ This phase must be performed as the agent "Tracker - Documentation Recorder" defined in ".opencode/agents/tracker.agent.md".
305
+
306
+ IMPORTANT:
307
+ - Read and apply the entire .agent.md spec (tools, constraints, quality standards).
308
+ - Base path: "{basePath}".
309
+ - Read the orchestrator log at "docs/.orchestrator-log.md" for the full pipeline record.
310
+ - Read any artifact files referenced in the log.
311
+ - Append documentation entries to "docs/tracker-log.md".
312
+
313
+ Pipeline summary:
314
+ {concise per-step table: step number, agent, status, test coverage result, artifacts}
315
+ ```
316
+
317
+ 2. Capture the tracker's confirmation of what was documented.
318
+
319
+ ### Step 5: Present Results
320
+
321
+ After all pipeline steps complete, present the user with:
322
+ - Overall status (all steps completed / partial / failed)
323
+ - Summary of each phase (RED results, GREEN results, VERIFY results, REVIEW results)
324
+ - Final test pass/fail counts
325
+ - Final coverage percentage and whether threshold was met
326
+ - TDD iterations used
327
+ - Next actions or recommendations
328
+ - Link to the full log file and plan file
329
+
330
+ ### Step 6: Persist Lessons Learned (Self-Improvement)
331
+
332
+ After every pipeline (or at the user's request), update the project's persistent knowledge file at `.agents/instructions/learned-knowledge.instructions.md`. This is how the system gets smarter over time — lessons from this session carry forward to future sessions.
333
+
334
+ **What to record:**
335
+
336
+ - **Test patterns discovered**: e.g., "This project uses beforeEach for common setup in Vitest"
337
+ - **Coverage gaps identified**: e.g., "Error boundary components consistently under-tested"
338
+ - **TDD friction points**: e.g., "Asynchronous tests require special setup in this codebase"
339
+ - **Conventions learned**: e.g., "Test files live in __tests__ directories alongside source"
340
+ - **Preferences expressed**: e.g., "User prefers integration tests over isolated unit tests for API routes"
341
+ - **Sub-agent tuning**: e.g., "The unit-tester needs explicit instructions to use the project's mock factory"
342
+
343
+ **Format:**
344
+
345
+ ```markdown
346
+ ## Session: {date}
347
+
348
+ **Pipeline:** TDD — implementer → unit-tester∥ (RED) → coder∥ (GREEN) → unit-tester (VERIFY) → reviewer → tracker
349
+ **Coverage:** {X}% (threshold: {minCoverage}%)
350
+ **TDD Iterations:** {N}
351
+
352
+ **New knowledge:**
353
+ - {pattern/convention/gotcha discovered}
354
+ - ...
355
+
356
+ **Agent tuning notes:**
357
+ - {agent role}: {what was learned about how to prompt it better}
358
+ ```
359
+
360
+ Append to the file — don't overwrite. Let it grow as a cumulative knowledge base.
361
+
362
+ ## Output Format
363
+
364
+ Always end with a structured summary:
365
+
366
+ ```markdown
367
+ ## TDD Pipeline Results
368
+
369
+ **Overall:** ✅ Complete | ⚠️ Partial | ❌ Failed
370
+
371
+ **Methodology:** RED → GREEN → REFACTOR/VERIFY
372
+ **Coverage:** {X}% / {minCoverage}% threshold | **TDD Iterations:** {N}
373
+
374
+ | Step | Phase | Agent | Status | Artifacts |
375
+ |---|---|---|---|---|
376
+ | 1 | PLAN | implementer | ✅ | /plan/feature-*.md |
377
+ | 2 | RED | unit-tester∥ | ✅ | {N} test files, {M} test cases |
378
+ | 3 | GREEN | coder∥ | ✅ | {N} source files |
379
+ | 4 | VERIFY | unit-tester | ✅ | Coverage report |
380
+ | 5 | REVIEW | reviewer | ✅ | Review notes |
381
+ | 6 | DOCUMENT | tracker | ✅ | docs/tracker-log.md |
382
+
383
+ **Tests:** {passed} passed, {failed} failed, {total} total
384
+ **Log:** docs/.orchestrator-log.md
385
+ **Plan:** /plan/{filename}
386
+ **Next:** {recommended next steps}
387
+ ```
388
+
389
+ ## Guidelines
390
+
391
+ - **Tests FIRST, always**: Never delegate to the coder before the unit-tester has finished writing tests.
392
+ - **Pass paths, not content**: Sub-agents should read files themselves from the base path.
393
+ - **Keep context minimal per step**: Don't dump the entire conversation; pass only the previous step's summary.
394
+ - **Log everything**: The log file is the single source of truth for what happened.
395
+ - **Fail gracefully**: If a sub-agent doesn't respond or errors, log the failure, inform the user, and decide whether to continue.
396
+ - **Don't bypass sub-agents**: Even for "simple" tasks, delegate. The orchestrator's job is coordination, not execution.
397
+ - **Use specific subagent_types**: Always use the precise subagent_type from the Sub-Agent Registry (e.g., `"coder"`, `"unit-tester"`). Never use `"general"` — it obscures which agent is running.
398
+ - **Respect the TDD discipline**: The RED phase writes tests that SHOULD fail. The GREEN phase writes minimal code to pass. Never let the coder preempt the unit-tester.
399
+ - **Test tracking is mandatory**: Every test suite must be tracked in `memory-bank/tasks/` with a task file, `_index.md` entry, and updates to `activeContext.md` and `progress.md`.
400
+ - **Coverage gate is enforced**: Do not proceed past VERIFY until coverage meets `minCoverage` or `maxTDDIterations` is exhausted.
401
+ - **Learn**: After results are presented, persist new knowledge to `.agents/instructions/learned-knowledge.instructions.md` so future sessions benefit.
@@ -9,7 +9,7 @@ permission:
9
9
  question: allow
10
10
  webfetch: allow
11
11
  websearch: allow
12
- model: openrouter/moonshotai/kimi-k2-thinking
12
+ model: deepseek/deepseek-v4-pro
13
13
  ---
14
14
 
15
15
  # Plan Mode - Strategic Planning & Architecture Assistant
@@ -8,7 +8,7 @@ permission:
8
8
  edit: allow
9
9
  "ddg-search/*": allow
10
10
  "context7/*": allow
11
- model: openrouter/moonshotai/kimi-k2-thinking
11
+ model: deepseek/deepseek-v4-pro
12
12
  ---
13
13
 
14
14
  # Technical spike research mode
@@ -6,7 +6,7 @@ permission:
6
6
  search: allow
7
7
  edit: allow
8
8
  "github/*": allow
9
- model: openrouter/deepseek/deepseek-v4-flash
9
+ model: deepseek/deepseek-v4-flash
10
10
  ---
11
11
 
12
12
  # Reviewer - Code Quality
@@ -7,7 +7,7 @@ permission:
7
7
  glob: allow
8
8
  edit: allow
9
9
  write: allow
10
- model: openrouter/deepseek/deepseek-v4-flash
10
+ model: deepseek/deepseek-v4-flash
11
11
  ---
12
12
 
13
13
  # Tracker - Documentation Recorder
@@ -6,7 +6,7 @@ permission:
6
6
  search: allow
7
7
  edit: allow
8
8
  execute: allow
9
- model: openrouter/deepseek/deepseek-v4-flash
9
+ model: deepseek/deepseek-v4-flash
10
10
  ---
11
11
 
12
12
  # Unit Tester - Test Coverage
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "$schema": "https://opencode.ai/config.json",
3
3
  "mcp": {
4
+ "chrome-devtools": {
5
+ "type": "local",
6
+ "command": ["npx", "-y", "chrome-devtools-mcp@latest"],
7
+ "enabled": true
8
+ },
4
9
  "ddg-search": {
5
10
  "type": "local",
6
11
  "command": ["npx", "-y", "ddg-mcp-search"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abarcenas/ai-workflow-template",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "A comprehensive template repository for AI-assisted development workflows using GitHub Copilot. This template provides a structured approach to leveraging AI assistance through pre-configured skills, prompts, agents, and coding standards.",
5
5
  "main": "index.js",
6
6
  "scripts": {